Motorbike Racer

Top  Previous  Next

This month I have developed a game prototype that can be expanded into a "real" top view or isometric racing game. I chose to use motorbikes for my example, but you can use cars as well. Actually, the car code can easily be obtained by removing a few lines (the ones that deal with the motorbike rolling) from the motorbike code.

 

The semaphore that gives the start of the race consists of a dynamic light that goes through red, yellow and green. Use the WSAD keys to control your motorbike and do your best to reach the finish line (the white flag) before the enemy does it.

 

aum107_racer1

 

The enemy uses a path-based movement code and will finish the level in about 27 seconds; nevertheless, if you are a skilled driver, you will be able to beat that score.

 

aum107_racer2

 

The message above will be displayed whenever the enemy wins the race; fortunately, you can restart the level and play another round by pressing a single key.

 

aum107_racer3

 

I hope that you have noticed the timer in the upper left corner of the screen; it's a clear proof that you can finish the level in under 20 seconds, thus beating the enemy each and every time. By the way, the enemy will adjust its speed automatically depending on the configuration of the road, lowering its speed when it takes a turn and increasing it whenever it is driving in a straight line.

 

The code is very well commented, as always.