blob: 83684745031bbc4d5cf357aecf48ace5d1ed66e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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()
|