diff options
Diffstat (limited to 'GUI.gd')
| -rw-r--r-- | GUI.gd | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -0,0 +1,14 @@ +extends Control + +const HP_WIDTH = 18 + +func update_hp_indicator(): + $HPIndicator.rect_min_size.x = GlobalData.player_hp * HP_WIDTH + $HPIndicator.rect_size = Vector2.ZERO + +func _ready(): + GlobalData.connect("player_hp_changed", self, "_on_GlobalData_player_hp_changed") + update_hp_indicator() + +func _on_GlobalData_player_hp_changed(_player_hp: int): + update_hp_indicator() |
