Archived

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

Problems with movement in 2d

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

Using what I could gather from the articles at this site, I assembled the following code. Unfortuanately, it yield erratic results and the object does not move as I want it to (not even in the right direction). 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
Keep in mind you have to have the angle where straight right is 0 and increases counter-clockwise from there. Also you have to use Radians as the angle, Radians=Degrees*pi/180. Hope that helps.

~WarDekar

Share this post


Link to post
Share on other sites
I think your problem may be is that cos/sin except radians not degree''s. I could be wrong though.

Share this post


Link to post
Share on other sites