Archived

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

mrman131

Problems with movement in 2d

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