Replies: 1 comment
-
Closing this as it's probably better to post on the discourse |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I was working with phaser in my own project when I got stuck in this very weird issue that took me a long time to investigate. I have 2 game objects, a rectangular menu, and some text on top of it, and I have pointerup events for both of them. When I click on the text, it does not receive the event, but instead the rectangle receives it, even though the text is rendered later and also on top of the rectangle. It took me a long time to figure out but it turns out that because I called set interactive first on the rectangle, if they both listen to the same event, only the first one that had setInteractive called receives it. Should it not be the first gameObject at the top in terms of depth?
As I have a library that abstracts away the rendering and the setInteractive call of the text and rectangle, I can't really just "change" the order of setInteractive called on the game objects, and it doesn't make sense to me intuitively, maybe I am missing something? Hopefully someone can help me with this
Sample code (the base phaser logic is abstracted away by vue,
<Rectangle>
just calls scene.add.rectangle and setInteractive)Beta Was this translation helpful? Give feedback.
All reactions