Jump to content

pixelPerfectOver into a variable


Jojo
 Share

Recommended Posts

I should be easy but not sure why I am not finding the answer,

 

I have set up a sprite as so

 

wheel.input.pixelPerfectOver = true;

 

I can see the info on the screen with,

 

game.debug.spriteInputInfo(wheel, 32, 32);

 

I can see all the object info with

 

console.log(wheel);

 

With in a function I want to find out if the mouse is with in the sprite image, in other words get the info that in on the screen into a variable.

 

I can see it on the screen but how to I get that info into a variable?

 

I have tried to many to count

 

wheel.input.pixelPerfectOver

wheel.hitArea

to name 2

 

Thanks for your help.

 

 

Link to comment
Share on other sites

You can check out the source code for Debug.spriteInputOver to see how it's getting the info it displays on the screen:

        this.line('x: ' + sprite.input.pointerX().toFixed(1) + ' y: ' + sprite.input.pointerY().toFixed(1));        this.line('over: ' + sprite.input.pointerOver() + ' duration: ' + sprite.input.overDuration().toFixed(0));        this.line('down: ' + sprite.input.pointerDown() + ' duration: ' + sprite.input.downDuration().toFixed(0));        this.line('just over: ' + sprite.input.justOver() + ' just out: ' + sprite.input.justOut());
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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