Jump to content
  • Advertisement


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


Problems with movement in 2d

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

I am having problems with the movement code in 2d enviorment. I have read the stuff on the site, and implemented what they say, but it doesn''t seem to work. When I try to move, it gives erratic results. Any help would be apprieciated. procedure TCar.move(); begin X := X + int(speed * cos(angle)); Y := Y - int(speed * sin(angle)); end;

Share this post

Link to post
Share on other sites
Guest Anonymous Poster

Is your variable ''angle'' in radians or degrees? If it is in degrees (which I assume it is) you''ll need to do something like this:

X := X + int(speed * cos(2*3.141593*angle/360));
Y := Y - int(speed * sin(2*3.141593*angle/360));

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!