federinik Posted June 19, 2014 Share Posted June 19, 2014 Hi everybody, I'm new in the forum as well in the html5 game developing. That's my problem: I have a sprite with a handler for the onUp event:mySprite = game.add.sprite(width, height, 'unchecked'); mySprite.inputEnabled = true; mySprite.input.useHandCursor = true; mySprite.events.onInputUp.add(function () { //handling... }, this, 0);Some linea above, I have a listener for the game's onUp eventgame.input.onUp.add(function () { //handling... }, this, 0);I would like to give priority to the sprite's event instead of the game's event. What can I do? Thank you F. Link to comment Share on other sites More sharing options...
horkoda Posted August 1, 2014 Share Posted August 1, 2014 Using 2.0.7. I'm a newbie. I have the same problem.Because the game input events (which I am using to detect on which tile the user clicked) are firing before the sprite events, I can't execute my game logic neatly. For my current situation, I view the game input events as "canvas" events. So they are below the sprites, and because I click on the sprite, I expected the sprite events to be fired first, then the game input events.Because it's the other way around, two things happen:game input event fires, the selected sprite moves to the position of the tile that's under the pointer enemy sprite input event fires, the selected sprite attacks the enemy spriteIf it were the other way around, I'd simply block the "move" action from happening, but now I can't reliably ascertain when the user wants to move or attack. EDIT: The more I think about it, the more I feel it's probably a design issue on my end, rather than a Phaser issue. But I'm not sure. Link to comment Share on other sites More sharing options...
Recommended Posts