-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenemy_hp_display.gd
41 lines (30 loc) · 1.03 KB
/
enemy_hp_display.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
extends PanelContainer
@onready var enemy_hp: GridContainer = %EnemyHP
func _ready() -> void:
print(self)
CombatManager.add_enemy_hp.connect(add_hp_die)
assert(CombatManager.add_enemy_hp.is_connected(add_hp_die))
CombatManager.remove_enemy_hp.connect(remove_hp_die)
assert(CombatManager.remove_enemy_hp.is_connected(remove_hp_die))
CombatManager.asd.connect(add_hp_die)
assert(CombatManager.asd.connect(add_hp_die))
func add_hp_die(side : DieSide):
print("hp added")
var new_hp : TextureRect = TextureRect.new()
new_hp.texture = side.texture
enemy_hp.add_child(new_hp)
func remove_hp_die(side : TextureRect):
print("die removed")
if side.texture == $EnemyHP/TextureRect.texture:
enemy_hp.remove_child(side)
# print("this shit doesnt work")
# pass
# else:
# print("add signal should be connected")
# print(CombatManager.add_enemy_hp.get_connections())
# pass
# print("this other shit also doesnt work")
# pass
# else:
# print("remove signal should be connected")
# print(CombatManager.remove_enemy_hp.get_connections())