Jump to content

How to get mouse position on big scenes


akhnos
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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