blob: b2e8d9b557df0cd28a0ed6c023d9824f79df6f2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
|