diff options
| author | Jan Tuomi <jan.tuomi@valuemotive.com> | 2022-08-15 09:35:35 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan.tuomi@valuemotive.com> | 2022-08-15 09:35:35 +0300 |
| commit | 8b0ce964d2aa5dba186b85abf64b70ffc8216c06 (patch) | |
| tree | 776e6149b78091cd377f6f421839e15186a2cba0 /GUI.gd | |
| parent | f3cc4f82624b21dafa19515b69c66a3c8f4fe248 (diff) | |
Add UI
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() |
