From 06647b11ee163bc40daf454d87e1fcae563c3ced Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 23 May 2024 14:11:43 +0200 Subject: update --- Scenes/Entities/Enemies/Components/Health.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Scenes/Entities/Enemies/Components') 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 -- cgit v1.2.3