mouse direction

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
DaedalusYoung
Party member
Posts: 413
Joined: Sun Jul 14, 2013 8:04 pm

Re: mouse direction

Post by DaedalusYoung »

You compare mouse.x with player.x, but they could both be using a different scale. Especially if you have a camera lib that changes the coordinate system, then player.x could be somewhere very high, say 2000 pixels, while the mouse coordinates are always somewhere inbetween 0 and, for example, 800. Clicking on coordinate 800 will make the game think you're clicking on the left side, not right. You'll need to convert the player's coordinates to the same values the mouse is using before you can compare them.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests