[Resolved]Getting angle of movement in radians via mouse
Hey guys. I am really trying to wrap my head around this. What I am trying to get done is when the mouse is moved, I need to calculate the degree in radians it moved based on the local coordinate space of a sprite the mouse is moving. Basically I need to fire a bullet in that direction when I hit the fire button. I know how to animate it and all that, but just can't figure out how to get the radians based on mouse movement.
Hope I explained that well enough. Think Geometry Wars as far as how I need to be firing the bullets. Any tips?
I will eventually be using a 360 controller using the left stick for this, but for the time being I need to do this with a mouse for testing stuff at work where I don't dare bring in a game controller. :p
Re: [Any language]Getting angle of movement in radians via mouse
I'd use the mousemovement event to get the X and Y value, compared against the last X and Y values (which you need to store in a global var), you can calculate the DeltaX and DeltaY.
Where is your problem, how the get those DeltaX and DeltaY or how to calculate the radians from DeltaX and DeltaY?
Re: [Any language]Getting angle of movement in radians via mouse
Getting the DeltaX and Y is my issue. I know how to get the radians.
My math is so rusty. Boo to getting old. :p
Re: [Any language]Getting angle of movement in radians via mouse
Hey man thanks. Just by what you said after thinking about it I figured it out. Rep coming your way. :)
Re: [Resolved]Getting angle of movement in radians via mouse
Thanks! :wave:
It's not only your math, that's getting rusty. I hope the math teached in the 20th century is still valid in the 21th ;)
Re: [Resolved]Getting angle of movement in radians via mouse
Oh snap. I am burned. :p
Thanks again.