moving a sprite in the proper direction
Hey all,
I''m just trying to move a 2d sprite in the proper direction (in OpenGL if it matters), and I keep getting weird results.
No matter WHICH direction my sprite is facing, it always moves upwards. argh.
When I''m processing the input from the player, I store the left and right rotation as a degree. (ie. rotated to the right by 10 degrees)
then if the player hits forward, he should MOVE in the direction he''s facing...
The algorithm I''m using to calculate this, is to first convert the rotation variable into radians. Then for the deltax take the sin of the result, and for deltay take the cos.
I''ve seen it done in a dozen different sources, yet I can''t seem to get mine moving in any other direction than up.
any clues??
thanks for any help!
Learn about game programming!Games Programming in C++: Start to Finish
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement