|Top Previous Next|
The idea came all of the sudden: I was thinking what project from my list should be turned into code this month, when I had an "Aha!" moment: I have realized that I didn't create any Mario clone until now. Well, due to my artistic abilities (or, to be more correct, their lack) the end result isn't looking like a Mario game at all, but it should give you enough code to get you started with a platform game.
It all starts nice and easy, with an area that is supposed to teach the player how to control his character using the left / right cursor keys, space for jumping and the left shift key to run. Don't forget about the shift key; it will come in handy whenever you're going to need to make longer jumps. Oh, and remember to press the "R" key whenever you die - this will restart the game.
Player's joy doesn't last for long, though, because the first enemies appear quickly:
These enemies might have innocent faces, but they've learned to slow down when they're close to the player, trying to hurt it as much as possible. Then, after moving away from these enemies, the player will meet a peaceful rabbit.
Actually, now that I think about it, this rabbit isn't peaceful at all; it fires shotgun bullets that take 10 points of player's health for every bullet. Fortunately, his eyesight isn't that good, so he won't be able to see the player if it is placed on another platform, even if it is at a slightly different height. You can make it much more aggressive by playing with its c_scan angles, but let's not turn this nice platform game into a violent shooter ;)
The game gets a bit more complicated, but can be finished without going trough too much trouble; the coins act as health packs as well, and since there are quite a few coins in the level, you won't die (unless you forget to use those long jumps I've told you about at the beginning of this article).
You will find a strange looking entity at the end of the level; approach it and you will be greeted with a well deserved message:
I have only created a level, but this part alone took me several hours. I'm not an artist, though, so I'm pretty sure that if you create some prefabs and reuse them wisely you're going to have game 30-50 levels that look much better than mine in only a few weeks.
The code is very well commented, as always.