Skip to main content
gamedev.net
🔒 Locked

2D Space Physics

Started by Krylar Sep 26, 2000 at 9:01 PM 1 replies 1k views
Original Post
Krylar
Krylar
I''m trying to make a field of stars on a 2D plane move appropriately under a ship based on the ship''s direction and speed. I have succeeded in doing that by getting a list of COS/SIN values that have been projected at 10-degree increments and multiplying appropriately. The problem is that my top speeds don''t adjust for X,Y based on direction. For example, let''s say that the top speed of my ship is 1.0, that *should* mean the following (taken at full thrust and top speed): 0-degrees(Due North): x=0, y=1.0 10-degrees: x=.1, y=.9 20-degrees: x=.2, y=.8 ... 90-degress(Due East) x=1.0, y=0 etc.. I''d like to have the ships have different top speeds and different thrust values for those speeds and real-time modifiers (like a booster, etc.). Hopefully this description makes sense. I''m going to keep digging, but if anyone knows the calculation for how to do this I''d appreciate the help! -Krylar Christian Coders Network
djsteffey
djsteffey
get the sin/cos values of your angle, then multiply that value by the speed of the ship.


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Krylar
Krylar
Hiya,
I finally figured this out after a bunch of digging.

I just uploaded a 2D spaceship physics tutorial with a 3-layered parallaxing starfield on my site. It comes with full source too.

You can get to it by heading over to the Christian Coders Network site and looking under the Articles section (or under "Krylar''s Games").

Enjoy!

-Krylar

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.