![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | erebrus |
I have ships flying in a background. I want to be able to select the ship by clicking on it and then click on a map location to select the ship destination. However, when I click on the ship to select it, the even is also later captured by the root node (or the parent area2d if I’m using one).
I want that the background (root node or parent area2d) only gets the event if I didn’t click on a ship. How do I do that?
Would you mind sharing a bit more on this?
It would help to tell us what kind of node the ship is and what signals you are reacting to. Maybe the signal also emits a variable with the signal that you can check on, like CollisionObject2Ds input_event?
That way you could raise a flag to ignore this event from being reacted on further but I don’t think you can stop signal propagation in godots hierarchie like you do in html and javascript.
ipdramon | 2021-10-30 10:13
The ship is a kinneticbody2d, it contains a sprite and a collider2d. I was connecting to the input_event() of the kinnecticbody2d. I found a better solution and I posted the answer. below.
thank you.
erebrus | 2021-10-30 11:12