Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Weird question, Moving the mouse and calculating its angle

Author
Message
Wartorn
18
Years of Service
User Offline
Joined: 24th Oct 2006
Location: Molde, Norway
Posted: 9th Apr 2007 20:26 Edited at: 9th Apr 2007 20:30
I have a question on how to calculate a way im moving the mouse for a 2d shooter. Say, if i move the mouse upwards to the right, i want my ship to fire that way, for an example from the middle of the screen to the upper right at a 45 degree angle. I must be able to do this for a full 360 degrees. Anyone have any pointers?
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Apr 2007 20:59
Lookup Atanfull in the index.

Wartorn
18
Years of Service
User Offline
Joined: 24th Oct 2006
Location: Molde, Norway
Posted: 9th Apr 2007 21:25
Thanks, only one problem, my sprite points the right way when moving left and right. But if i move it from the center to the upper right, it points to the lower right, same with the other way around.. do you know why?
Wartorn
18
Years of Service
User Offline
Joined: 24th Oct 2006
Location: Molde, Norway
Posted: 9th Apr 2007 21:49
I noticed that if i pull the mouse down it has a rotation of 0 degrees, but if i pull the mouse up it shows a rotation of 180 degrees. Any way i can make it do the opposite?

Login to post a reply

Server time is: 2024-11-25 20:29:47
Your offset time is: 2024-11-25 20:29:47