View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# 2D wierd movement...

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1Prod  Members

Posted 25 November 2001 - 12:38 PM

I was wondering,(This is in a 2 dimensional view, not 3D) how do you get something to move in the direction its facing? Im making a little space sim, and i want the ship to be able to turn =p. what im trying to accomplish is when i hit VK_UP it will move forward, and the VK_LEFT will turn it left and the VK_UP key will now move the ship the direction i turned with VK_LEFT.

### #2HellRiZZer  Members

Posted 25 November 2001 - 01:02 PM

You have to store the angle of your object angle. E.g if it facing up, then its 90 degrees, right - 0 degrees and so on.
So, when you press ''move forward'', your object will move

x+=xspeed*cos(A);
y+=yspeed*sin(A);

or something like that.
So, when you press left, A+=rotationspeed;
or right A-=rotationspeed;

### #3Prod  Members

Posted 25 November 2001 - 03:39 PM

thanks, i will try it out

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.