Started my first godot project and have now gotten stuck ...
The main scene is a room, I spawn a box (kinematicbody2d) with add_child. The box falls to the floor of the room and stops. This part works fine. I then need to detect a mouse click inside the box.
I tried adding _input(event) function to detect a left mouse click inside the box. This kind worked or so I thought, unfortunately the problem is it doesn't matter if I click in or outside of the box, _input(event) treats it the same, as long as I left click somewhere in the room.
I was then informed that I should use inputevent() to detect inside the box and make the kinematicbody2d pickable. Then check if event type is InputEventMouseButton and event is pressed. I've tried this but it doesn't detect any mouse click, never gets into the method when I click anyway.
It was also suggested I add an area2d with a collisionshape as a child to the parent kinematicbody2d. I tried this and still couldn't get the mouse click to fire off the input_event(). I didn't like having a collisionshape for the kinematicbody2d and a duplicate for the area2d anyway but would do this if I had to. Not sure if I did that part correctly.
I am only getting a result from input(). I added print(event) in that function and it does print InputEventMouseButton ... just doesn't ever get to _inputevent() when I try to use that instead with left mouse click.
It was also suggested I use unhandledinput(event) but I do not even no where to start with that one.
So, as a beginner I am failing miserably somewhere.
1) Any idea what I am missing here? Could it have something to do with main scene add_child? Any suggestions what to try next?
2) Also, more boxes could fall and they should collide with the box below it. With that in mind and the fact I need to detect a click inside each box, is kinematicbody2d the correct node to start with?
Thanks for any assistance!