Saturday 7 January 2012

Making gravity work against you

Just a quick update to the game mechanic for player death.

Originally, if you touched anywhere other than the roof on a building, you would die. You could descend full speed down on to the roof and still survive.

In the original flash game (and lunar lander) you had to control your descent with your thrusters and couldn't come down full speed.

A simple addition to the player code now checks to see if the descent rate is too fast and returns an boolean true so the collision can be considered fatal even if you do collide with the roof.

I've also added Fuel in for the player, just a simple int that decreases every time you thrust. When you're out of fuel, you can no longer thrust, meaning you fall to your death!

The last addition is a Lives variable on the player, which I will use in the game to decrease every time you crash and when you reach 0 it's game over.

No comments:

Post a Comment