summaryrefslogtreecommitdiff
path: root/Scenes/Entities/Enemies/Components/Health.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-05-23 14:11:43 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-05-23 14:11:43 +0200
commit06647b11ee163bc40daf454d87e1fcae563c3ced (patch)
tree866823ed79fa1c3bbdcb8b0be417f028f0c92d9b /Scenes/Entities/Enemies/Components/Health.gd
parent276b7664bd4a475a3ca93a682c16b49c504c58f7 (diff)
update
Diffstat (limited to 'Scenes/Entities/Enemies/Components/Health.gd')
-rw-r--r--Scenes/Entities/Enemies/Components/Health.gd5
1 files changed, 4 insertions, 1 deletions
diff --git a/Scenes/Entities/Enemies/Components/Health.gd b/Scenes/Entities/Enemies/Components/Health.gd
index 6f65e79..2bd2447 100644
--- a/Scenes/Entities/Enemies/Components/Health.gd
+++ b/Scenes/Entities/Enemies/Components/Health.gd
@@ -21,6 +21,8 @@ var drop_items = [
preload("res://Scenes/Entities/Objects/Coin.tscn"),
]
+var is_dying = false
+
func _ready():
if component_movement_path:
@@ -30,11 +32,12 @@ func _ready():
func take_damage():
health -= 1
- if health <= 0:
+ if health <= 0 and not is_dying:
death()
func death():
+ is_dying = true
emit_signal("died")
if component_movement: # stop all movement