Mouse position isn't accurate with graphics translation.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Dr.Tyler O.
- Citizen
- Posts: 58
- Joined: Tue Jul 29, 2014 9:17 am
- Location: United States
Mouse position isn't accurate with graphics translation.
In the game that I'm making, you right click and a menu pops up right next to the mouse that gives you a list of options for the object you right clicked (similar to something like this: http://www.zybez.net/img/genimg/getting ... ptions.png). But when I added love.graphics.translate() to make the camera stick to the player, the right click menu gets farther away from the player as the player moves. I don't know a lot about the camera functions in love but I feel like I'm doing it completely wrong. I simply put love.graphics.translate(x, y) in love.draw() and that's it. That also causes text to lag behind the player when the camera moves but that is irrelevant to my current question.
Any topic I have ever posted that I felt did not require a .love file, although they were requested, never required one so I would appreciate if you did not ask me to supply one unless you think that I am ignorant for not doing so.
Re: Mouse position isn't accurate with graphics translation.
Post the code.... or a love file and we can help you!
That is going to be my signature from now on because I'm kind of tired of typing it in threads that ask a question but never post the code or a love file...
Your code can't be that amazing that someone here is going to steal it... Because if it was you would not be on these forums asking these questions.
That is going to be my signature from now on because I'm kind of tired of typing it in threads that ask a question but never post the code or a love file...
Your code can't be that amazing that someone here is going to steal it... Because if it was you would not be on these forums asking these questions.
Re: Mouse position isn't accurate with graphics translation.
Love.graphics.translate doesn't affect the mouse input coordinates. You need to apply the offset to the mouse x and y positions in reverse.
For example, if you translate the x coordinates by 5, you need to subtract 5 from the mouse x.
There is no need to get rude here. Sometimes you can figure stuff out even without the code.
For example, if you translate the x coordinates by 5, you need to subtract 5 from the mouse x.
There is no need to get rude here. Sometimes you can figure stuff out even without the code.
- Dr.Tyler O.
- Citizen
- Posts: 58
- Joined: Tue Jul 29, 2014 9:17 am
- Location: United States
Re: Mouse position isn't accurate with graphics translation.
My question was just answered right after you stated this. In my opinion, most questions don't require a love file unless the problem is really in depth. Thank you for trying to provide help though.artofwork wrote:Post the code.... or a love file and we can help you!
That is going to be my signature from now on because I'm kind of tired of typing it in threads that ask a question but never post the code or a love file...
Your code can't be that amazing that someone here is going to steal it... Because if it was you would not be on these forums asking these questions.
Thanks dude.Xrott wrote:if you translate the x coordinates by 5, you need to subtract 5 from the mouse x.
Any topic I have ever posted that I felt did not require a .love file, although they were requested, never required one so I would appreciate if you did not ask me to supply one unless you think that I am ignorant for not doing so.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Mouse position isn't accurate with graphics translation.
In this case, Xrott guessed right. Without a .love, that's all we can do: guess.
Please always supply a .love. It is a courtesy to the people helping you as much as it helps yourself (because it's more likely you get the right answer right away).
Please always supply a .love. It is a courtesy to the people helping you as much as it helps yourself (because it's more likely you get the right answer right away).
Help us help you: attach a .love.
Re: Mouse position isn't accurate with graphics translation.
No, I didn't guess. I actually read the first post and it was pretty clear what the problem was.
Now, I know you get the situation a lot, where you can't actually help without a .love and I'm not saying that people shouldn't post their code initially, but some of you seem to be a bit prematurely dismissive about topics without .love files.
If you ask me, try to help first, and yell about posting the code later, when that didn't work.
Now, I know you get the situation a lot, where you can't actually help without a .love and I'm not saying that people shouldn't post their code initially, but some of you seem to be a bit prematurely dismissive about topics without .love files.
If you ask me, try to help first, and yell about posting the code later, when that didn't work.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 7 guests