Physics for space game
I am making a space game where you fly a ship.
I am trying to work out the physics for such a game and so far came up with:
var thrust; //between 1 & 100 how much the engines are pushing
var mass; // the mass of the spaceship
var speed; //the speed at which the spaceship is moving
Now big ships will have more mass to therefore take longer to speed up and longer to slow down once the thrust is off. Big ships will be slow because of the mass.
Small ships will speed up faster and slow down faster but also go faster.
How will I implement this into a game? I can do the keyevents, if up is pressed for 5 frames for example will I make the thrust raise to by 10 each frame(example) and then increase the speed of the ship based on some formula of the mass & thrust?
This is the game: Only UI and menus made but wan to get an idea of my physics before I implement the movement http://www.taffatech.com/DarkOrbit.html
I am making a space game where you fly a ship.
I am trying to work out the physics for such a game and so far came up with:
var thrust; //between 1 & 100 how much the engines are pushing
var mass; // the mass of the spaceship
var speed; //the speed at which the spaceship is moving
Now big ships will have more mass to therefore take longer to speed up and longer to slow down once the thrust is off. Big ships will be slow because of the mass.
Small ships will speed up faster and slow down faster but also go faster.
How will I implement this into a game? I can do the keyevents, if up is pressed for 5 frames for example will I make the thrust raise to by 10 each frame(example) and then increase the speed of the ship based on some formula of the mass & thrust?
This is the game: Only UI and menus made but wan to get an idea of my physics before I implement the movement http://www.taffatech.com/DarkOrbit.html
No comments:
Post a Comment