extends Control @onready var player = get_tree().get_first_node_in_group("player") as Player @onready var hp_scene = preload("res://HP.tscn") func _ready() -> void: for child in $HBoxContainer.get_children(): $HBoxContainer.remove_child(child) for n in range(player.max_hp): $HBoxContainer.add_child(hp_scene.instantiate()) player.hp_changed.connect(func(): for n in range(player.max_hp): if n < player.hp: $HBoxContainer.get_child(n).set_full() else: $HBoxContainer.get_child(n).set_empty() )