Jump to content

How to Detect if Mouse Click is over a sprite?


glass22
 Share

Recommended Posts

Not tested, but should work

yoursprite.inputEnabled = true;yoursprite.input.useHandCursor = true; //if you want a hand cursoryoursprite.events.onInputOver.add(yourFunction, this);function yourFunction(event, sprite){  // ... your code}

You have more events in: http://gametest.mobi/phaser/docs/Events.js.html

 

another untested way:

yoursprite.inputEnabled = true;//..inside your update() function...if (yoursprite.input.pointerOver()) {   //..your code}

you have a lot of stuff in yoursprite.input http://gametest.mobi/phaser/docs/Phaser.InputHandler.html#toc42

 

 

Link to comment
Share on other sites

  • 3 months later...
 Share

  • Recently Browsing   0 members

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