Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

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


Sign up now

2D wierd movement...

4: Adsense

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.


  • You cannot reply to this topic
2 replies to this topic

#1 Prod   Members   

134
Like
Likes
Like

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.

#2 HellRiZZer   Members   

308
Like
Likes
Like

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;

#3 Prod   Members   

134
Like
Likes
Like

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.