Blaster Girl |
Top Previous Next |
This month I have created a combination of a Pacman and Bomber game, so more proper project name would have been... Pacber, right? Still, since the player is a little girl and she can blast things up, I have decided to name the project Blaster Girl.
So what does this little girl do and what can we learn by studying the code?
Everything starts with a simple level, with our little girl being chased by two giant mosquitos. The good news is that our girl can make use of the red mushrooms that pop up in the level from time to time, because (believe it or not!) what your mom told you about the red mushrooms is true: they are poisonous, and in addition to this, they can explode when being handled by little girls.
Your mission is to move around in the level using the cursor keys, staying away from the mosquitos and collecting the mushrooms if you can catch them (they will appear in the level for a limited time). Then, use the space key to place them near the mosquitos and run away; don't stay too close to the mushrooms because their explosion can kill you as well. The levels get more and more complex; there are three levels in this demo, but nothing prevents you from creating as many levels as you want.
OK, so what can we learn from this code snippet? First of all, there are two types of tile-based movement; one of them (used for player's code) controls the player by changing its x and y coordinates, while the other (used for the mosquitos) uses c_move to achieve results that are almost as good as player's extremely accurate movement. Then, we can also learn how to do proper collision detection in tile-based levels. And let's not forget that we've gotten code for enemies that can navigate complex levels by determining their surroundings (with a hint of randomness, to keep the things more exciting).
The code is very well commented, as always.
|