16 lines
287 B
GDScript
16 lines
287 B
GDScript
extends Control
|
|
|
|
func _ready() -> void:
|
|
EventBus.health_changed.connect(_on_health_changed)
|
|
_on_health_changed(3)
|
|
|
|
func _on_health_changed(new : int):
|
|
var i = 0;
|
|
for c : HealthHeart in get_children():
|
|
print(i, new)
|
|
if i < new:
|
|
c.set_full()
|
|
else:
|
|
c.set_empty()
|
|
i += 1
|
|
|