first_anniversary_godot_jam/scripts/Library/Actions/TriggerOnCollision.gd

12 lines
307 B
GDScript

class_name TriggerOnCollision extends TriggerBase
export(NodePath) var collision_area
export(NodePath) var action
func _ready():
get_node(collision_area).connect("body_entered", self, "_on_body_entered")
func _on_body_entered(_body: Node):
print("Collision action triggered")
triggerNodePath(action)