Jump to content
  • Advertisement


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


moving a sprite in the proper direction

This topic is 6129 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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!