extends Control var max_hp: int @onready var hp_scene = preload("res://BossHP.tscn") func initialize(hp: int): max_hp = hp for child in $HBoxContainer.get_children(): $HBoxContainer.remove_child(child) for n in range(hp): SoundManager.play_sound("BossHpFill") $HBoxContainer.add_child(hp_scene.instantiate()) await get_tree().create_timer(0.1).timeout Game.boss_hp_changed.connect(func(new_hp): for n in range(max_hp): if n < new_hp: $HBoxContainer.get_child(n).set_full() else: $HBoxContainer.get_child(n).set_empty() )