a game about throwing hammers made for the github game off
Diffstat (limited to 'ui/hud/health_meter.gd')
| -rw-r--r-- | ui/hud/health_meter.gd | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ui/hud/health_meter.gd b/ui/hud/health_meter.gd index 248009a..115287a 100644 --- a/ui/hud/health_meter.gd +++ b/ui/hud/health_meter.gd @@ -3,12 +3,14 @@ extends Control @onready var full := $Full as TextureRect @onready var empty := $Empty as TextureRect + func _ready(): - Globals.player.hp_changed.connect(_hp_changed) - var max_hp := Globals.player.max_health - await get_tree().process_frame - full.size.x = max_hp * 5 + 1 - empty.size.x = max_hp * 5 + 1 + Globals.player.hp_changed.connect(_hp_changed) + var max_hp := Globals.player.max_health + await get_tree().process_frame + full.size.x = max_hp * 5 + 1 + empty.size.x = max_hp * 5 + 1 + func _hp_changed(hp: int): - full.size.x = hp * 5 + 1 + full.size.x = hp * 5 + 1 |