Making an object move in a certain angle

Started by
0 comments, last by EdwardD 20 years, 7 months ago
Im using C# with DX9. I want to try get my sprite to move at an angle of say 30.... how do I go about doing that... I know it has something to do with SIN and COS, I tried it, but its not working properly... Anybody got an example? Thanks, ED
Advertisement
I'd guess it's cause you pass degrees and not radians to the cos() and sin() funcs.

EDIT: If you still don't get it right...
newpos_x += cos( angle ) * number_of_pixels_to_move;
newpos_y += sin( angle ) * number_of_pixels_to_move;

EIDT #2: I'm a dumbass, didn't realise you used C#... Well, maybe the syntax is wrong but the logis remains the same.


[edited by - Enselic on September 1, 2003 12:49:20 PM]

[edited by - Enselic on September 1, 2003 1:12:41 PM]
[s]--------------------------------------------------------[/s]chromecode.com - software with source code

This topic is closed to new replies.

Advertisement