Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

onInputUp event does not fire if the initial mouseDown was outside of the sprite


pizzapizza
 Share

Recommended Posts

I am using events.onInputUp.add on my Phaser.Sprite, but it is not working the way I need it to for my game.  If I press down on my sprite and then release, it works, but if I press down anyplace else on the screen, rollover my sprite, and then release, the inputUp event never happens even though I am over my sprite and releasing.  I need the up event to fire regardless of where the initial down event occurred.   Any ideas?

Link to comment
Share on other sites

On 3/13/2018 at 5:17 PM, samme said:

I think you'll have to listen to

and then coordinate the two somehow.

 

That worked!  I listened for the over/out events on the sprite to keep an "isOver" variable, and then doing this on the sprite

game.input.onUp.add(function(){if(this.isOver){functionToRunOnMouseUp();}});

Thanks for the clue sending me in the right direction!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...