Jump to content

Sprite x and y location relative to window instead of world


ForgeableSum
 Share

Recommended Posts

If you get the top and left offsets of the Phaser canvas you can add those to your sprite's x and y values to get the page position of your sprite. I don't know if Phaser has the offsets to hand (it probably does) but with jQuery you can do this:

var offsets = $(game.canvas).offset();console.log(offsets.top, offsets.left);
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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