Jump to content
  • Advertisement


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


Still need help

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

Still having no luck in moving a sprite in the direction it is pointing. My sprite moves a full 360 in 10 degree intervals. The sprite is located at variable was XPos and YPos. Trying to use sin and cos but with still no luck. Below is my function(which doesnt work of course) for moving the sprite in the particular direction it is facing. PLease anyone help. Really really need it. void cShip::ThrustShip(float speed) { double Radian; Radian = ShipAngle * 0.01745; //pi / 180 = 0.01745 VelX += sin(Radian) * speed; VelY -= cos(Radian) * speed; XPos += VelX; YPos += VelY; }

Share this post

Link to post
Share on other sites
please do correct me if im wrong, but if ShipAngle follows normal circle ideas (what i know anyway 0 ->, 180 <-, 90 ^, etc.), cos would be the xpos and sin would be the ypos wouldnt it? mind u its 11pm here now and im on holidays so dont trust this judgement until u think about it...

"Did you hear the one about the nun and the rabbi?"
JUST PRINT (typed)
"Okay, okay, Asshole!!" - Wrongfully Accused

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!