Problems with movement in 2d

Started by
1 comment, last by mrman131 22 years, 8 months ago
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;
Advertisement
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
~WarDekar
I think your problem may be is that cos/sin except radians not degree''s. I could be wrong though.

This topic is closed to new replies.

Advertisement