diff options
Diffstat (limited to 'Scenes/Entities/Enemies/Components')
-rw-r--r-- | Scenes/Entities/Enemies/Components/Collision.gd | 4 | ||||
-rw-r--r-- | Scenes/Entities/Enemies/Components/Health.gd | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Scenes/Entities/Enemies/Components/Collision.gd b/Scenes/Entities/Enemies/Components/Collision.gd index 2dfba2a..6e25402 100644 --- a/Scenes/Entities/Enemies/Components/Collision.gd +++ b/Scenes/Entities/Enemies/Components/Collision.gd @@ -14,9 +14,11 @@ signal collided @export_node_path("Component_Health") var component_health_path: NodePath var component_health: Component_Health +var collision_area: Area2D + func init(): - var collision_area = Utilities.Collision.Area.new(entity, collision_shape) + collision_area = Utilities.Collision.Area.new(entity, collision_shape) collision_area.set_collision_mask_value(Utilities.Collision.Layer.PLAYER, true) collision_area.connect("collided", func(area): emit_signal("collided", area)) entity.add_child(collision_area) diff --git a/Scenes/Entities/Enemies/Components/Health.gd b/Scenes/Entities/Enemies/Components/Health.gd index f5e231e..d6b7361 100644 --- a/Scenes/Entities/Enemies/Components/Health.gd +++ b/Scenes/Entities/Enemies/Components/Health.gd @@ -3,6 +3,8 @@ extends Node class_name Component_Health +signal died + @export_node_path("CharacterBody2D") var entityPath: NodePath @onready var entity: CharacterBody2D = get_node(entityPath) @@ -20,6 +22,8 @@ func take_damage(): func death(): + emit_signal("died") + entity.set_physics_process(false) sprite.play("death") |