diff options
Diffstat (limited to 'Scenes/Entities/Enemies/Components')
-rw-r--r-- | Scenes/Entities/Enemies/Components/Health.gd | 5 |
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 |