• Advertisement

Archived

This topic is now archived and is closed to further replies.

moving a sprite in the proper direction

This topic is 5865 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement