🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Can i do some stuff with angles? (in vc++ 6.0 off course)

Started by
0 comments, last by SigwarthSoft 24 years, 5 months ago
Hello again... the question is: how can i turn an object by hitting the left or right button. I want to create something like a moving car, i have the forward and backwards but the turning is a problem. Well a problem, i simply don''t know. Anybody? Sig
Advertisement
wow, i need more details than that...

are you talking about 2d tile engine with a moving car, or a 3d engine ?

from your title i see you tried angles,
i think angles is not the right approch, what you need is Vectors.
Me and my friend did a car game on tile-engine and this is how we did it:
In a 2d engine your car would have a speed vector defined by two floats (vx,vy). its length would be how fast the car is going. for example each second the car would move from x to x+vx and from y to y+vy. to increase the speed you multply both vx and vy by more than one (lets say 1.1) and to decrease you multply both by less then one (0.9). TO TURN AROUND all you''ll have to do is rotate the speed vector. If you dont know vector math yet then you can define the vector with an angle and a radius and calculate vx and vy with Trig,(cos and sin). If you dont know Trig dont expect your car to turn...

If you are thinking 3d its all the same but with a vZ. but for 3d you shouldnt even try trig, get a math book and learn matrices and vectors...

This topic is closed to new replies.

Advertisement