pirate-survivors/Player/hud.gd
2026-01-17 18:36:34 +01:00

23 lines
590 B
GDScript

extends CanvasLayer
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
#var player = get_parent().get_node("player")
var player = get_parent()
update_score(player.score)
update_life(player.life / player.life_max * 100.0)
func update_score(score: int) -> void:
$ScoreLabel.text = "Score: " + str(score)
func update_life(life_percentage : float):
$LifeProgressBar.value = life_percentage