Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | jahu00 | |
Old Version | Published before Godot 3 was released. |
In my puzzle game, every time the user levels up, a popup is shown. I make an instance of an animated scene with an overlay.
The root of the popup scene is an Area2D
and it has is a CollisionShape2D
as its child. I have signal connected the input_event
. I want to detect if any part of the popup scene was clicked and hide it. However the input_event
is only called when the popup scene is initialized (possibly while the mouse button is still clicked), but doesn’t react to any inputs later on. Am I missing something?
I have similar setup for tiles in my game, but input_events
work on all of the tiles just fine.
P.S. One of the children of my popup scene is a ColorFrame
.
- Which version of the engine is this in?
- In Godot 2.1.x,
CollisionObject2D._input_event
is processed last, and only if the input has not already been handled by any of the other nodes (source). This could be related to the issue, but I won’t know without examining the scenes/scripts involved. - Have you considered simply using a Popup-derived node instead of an
Area2D
for this? Using dedicatedControl
-derived nodes for handling UI input is going to help your project operate as expected much more easily than if you use collision-detection logic like anArea2D
that isNode2D
-derived.
Will Nations | 2017-10-29 04:04
It’s Godot 2.1.4 (the one one Steam).
Then I guess, it is possible that the input is already handled by the tiles (which have the same input_event setup, but actually work as intended).
I used a scene, because I wanted the popup to look fancy (animations and all).
jahu00 | 2017-10-29 10:58
if you can show the code on the area script, could be helpful, maybe you are not using the exact syntax for the method.
eons | 2017-10-31 01:44