Topic was automatically imported from the old Question2Answer platform.
Asked By
System_Error
Hi all. Trying to get something to work, but I don’t really know how to do it.
What I have is a Node, with a child(Area2D) and grandchild(CollisionShape2D). The whole scene will be instanced into the main scene. What I’d like to do is send a signal to another instanced scene when a player left-clicks in the Area2D’s sector.
Area2D extends CollisionObject2D. You may use _input_event
extends Area2d
signal your_signal
func _on_Area2D_input_event( viewport, event, shape_idx ):
if (event.type == InputEvent.MOUSE_BUTTON && event.pressed):
emit_signal("your_signal")
But you have to connect to signal from this object to listen it. You may also try to put such signal in some upper/common level (for example your main scene) and then emit it from this event catching. main_scene_node.emit_signal(“your_signal”)
Hey, would you clarify what this would do? I’m having a hard time understanding it.