From f27937e6e9b6a7146dd09fc711d2d293ecf5abbf Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 14 Apr 2024 21:49:20 +0200 Subject: update --- Scenes/Entities/Enemies/Components/Collision.gd | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Scenes/Entities/Enemies/Components/Collision.gd (limited to 'Scenes/Entities/Enemies/Components/Collision.gd') diff --git a/Scenes/Entities/Enemies/Components/Collision.gd b/Scenes/Entities/Enemies/Components/Collision.gd new file mode 100644 index 0000000..b2e8d9b --- /dev/null +++ b/Scenes/Entities/Enemies/Components/Collision.gd @@ -0,0 +1,18 @@ +extends Node + +class_name Component_Collision + + +signal collided + +@export_node_path("CharacterBody2D") var entityPath: NodePath +@onready var entity: CharacterBody2D = get_node(entityPath) + +@export_node_path("CollisionShape2D") var collision_shape_path: NodePath +@onready var collision_shape: CollisionShape2D = get_node(collision_shape_path) + + +func init(): + var collision_area = Utilities.Collision.Area.new(entity, collision_shape) + collision_area.connect("collided", func(area): emit_signal("collided", area)) + entity.add_child(collision_area) -- cgit v1.2.3