I want my player to follow my mouse. I know how to do it with directions. But i dont wanna use direcations, just angle. I want him to change angle so his looking at my mouse all the time. :)
Printable View
I want my player to follow my mouse. I know how to do it with directions. But i dont wanna use direcations, just angle. I want him to change angle so his looking at my mouse all the time. :)
Here is a related post with the math and an example MFA:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=236571
;)
ATan2(Y( "My Object" )-YMouse, XMouse-X( "My Object" ))
That code dosent work for me.
It only change angle when i drag the mouse up and down not
left and right.
You may be doing it wrong - did you look at the attached example? It works perfectly here.
Well i dosent work like i want it in the example either.
maybe its something wrong on my client?
In the example, if you drag your mouse up and down your change angle(only), but if you drag your mouse left and right you change the scale(only).
Have you tried moving your mouse in a circle around the center of the screen? I think you're misunderstanding how it works.
Ive been trying for a long time. if i move it in a circel around the center. The line moves 180grades only,(half circel). And it dosent even look like its folloing my mouse. Something is wrong with my exemple. :( i wish i could record it and show you :)
Huh, it should rotate like this:
http://www.youtube.com/watch?v=35ko0cFUAMQ
I just used CamStudio to record the video.
What build of MMF2 do you have? The latest is R251. If it only rotates 180 degrees, that sounds like you are on a very old version of MMF2...
Nay. I be on build 248, and arctangent works fine. It worketh fine on 247 too, I remember. I don't know what's happening on your machine. Did you write Atan instead of Atan2?
Could it be something with your animation or the condition? Just write Always for the condition. You probably want to set the hotspot to the center. You may want to check if the object's really not turnign or just appears to not turn.
You can post an example in the file archive.
Watermelon, in an older version of MFM2, there was no ATan2.