I am making an asteroids game and cant get my ship to move correctly ... I have revised on some algebra and mostly understand it but not completely how to apply it.
My little ship gains momentum but does not slow down for now (this is intentional)
This is how it gains momentum:
object.XVel += cos(object.angle) * (ACCELERATION * TimeFrame);
object.YVel += sin(object.angle) * (ACCELERATION * TimeFrame);
And this is how I move the ship aroumd:
object.XPos += cos(object.angle) * (object.Velocity * TimeFrame);
object.YPos += sin(object.angle) * (object.Velocity * TimeFrame);
The only problem is when I change the angle of the ship it changes the direction it is traveling in to what seems like a random direction ....
This is how it turned out:
http://www.xyuri.com/OpenGL Test.exe
Can anyone help me out with this one?
EDIT:
also, if I do (sin(30) * 1) on my calculator I get (0.5) but using the functions in c++ I get (-0.988032)
Why is this?
[Edited by - xyuri on December 4, 2004 5:24:32 PM]
__________Michael Dawson"IRC is just multiplayer notepad." - Reverend