moving a sprite in the proper direction

Started by
0 comments, last by wazoo69 22 years, 2 months ago
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
Advertisement
Can you post a code snippet? Might help us identify the problem or offer more directed suggestions.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement