2024-04-20 15:36:26 +00:00
|
|
|
class_name TriggerOnCollision extends TriggerBase
|
2024-04-20 15:17:19 +00:00
|
|
|
|
2024-04-20 15:36:26 +00:00
|
|
|
export(NodePath) var collision_area
|
2024-04-20 16:02:17 +00:00
|
|
|
export(NodePath) var action
|
2024-04-20 15:17:19 +00:00
|
|
|
|
|
|
|
func _ready():
|
2024-04-20 16:02:17 +00:00
|
|
|
get_node(collision_area).connect("body_entered", self, "_on_body_entered")
|
2024-04-20 15:36:26 +00:00
|
|
|
|
2024-04-20 16:02:17 +00:00
|
|
|
func _on_body_entered(_body: Node):
|
|
|
|
print("Collision action triggered")
|
|
|
|
triggerNodePath(action)
|