Jump to content

How to get mouse position on big scenes


Recommended Posts

i have big scene on my game (4000 x 4000 tilemap). Mouse.x is not working like Sprite.x. {sprite.x, sprite.y} is giving {x: 1500,y:1500} but {mouse.x, mouse.y} is giving {x: 600, y:450}. Is there a way to get mouse position like sprite position ? (It has to give {x: 1500, y:1500})


I'm using this algorith:


mousePosX = game.input.x + (sprite.x - sprite.position.x);

mousePosY = game.input.y + (sprite.y - sprite.position.y);


But i guess there has to be a easier way. Thank you

Link to comment
Share on other sites


  • Recently Browsing   0 members

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