Sorry for asking so simple a question, but does anyone know how I can make a sprite move at a given angle.
So say I have a ball at position 100 100. I want it to move at a 80 degree angle. How would I do this?
Hmm I think this should be some sin and cos calculations.
First you need to say wich degree system you want. the one where 0 degrees is right and when the ammount increases the direction goes anti-clockwise.
Or the one where 0 is up and direction is clockwise.
If you want the first you can do something like this:
|x += cos(angle) * speed;|
y += sin(angle) * speed;
Please note that the angle is in radians (the calculation above).
A little thingie to change radians to degrees and back:
|radians = degrees/57.2958|
|degrees = radians*57.2958|