How to get the input event of an instance scene from the main scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sanjib
:warning: Old Version Published before Godot 3 was released.

I have two scenes, one “main scene” and another is “player scene”. Player Scene comprises of rigidbody2d with collisionshape2d nodes,i set rigidbody2d as pickable true and set built-in script for player input_event. I want to know when the rigidbody2d of player scene is clicked or touched. I could get the input event generating when i play the player scene , but when i instance the player scene on main and try to play, the event is not generating.

I tried with emit_signal but i could not get the solution. Help is appreciated.
Thanks

can you share the project?

Nuno Donato | 2017-03-27 16:52

:bust_in_silhouette: Reply From: DodoIta

You could try using Area2D type instead of Kinematic and follow this example (just look at the .gd file).

Otherwise you could get the sprite’s extents and position(I’m assuming you have a Sprite node :P), get the mouse-click coordinates and check if they are inside your sprite.

Thanks, i got the solution, i used TextureButton with RigidBody2d and its pressed event worked fine.

sanjib | 2017-03-27 18:34