Ladder Platform Game
Introduction
This game is very loosely based on old game from the 1980s called Bonzo. That game consisted of a series of platforms accessed via ladders. You needed to collect boxes to exit the level and avoid the enemies. This version contains a very basic AI for one of the enemies.
Hero
As with all of these games, we are making functions to break up our code and make it easier for us to read and work with. You find the functions blocks under Advanced. It should be fairly clear what is going on here,
Level Design
Use the Rectangle tool to do the outline more quickly. The top row is a double line. I used a built-in sprite for the ladders. You can do a little better if you draw your own - like in the image at the top of this page. This tile map is 32x32 - you could go larger if you have the time and the patience.
Then, click on MyTiles, click the + to add a new tile. Choose to edit this new tile,
Make it solid white. Then use this new tile for everything that isn't wall or ladder. This will be used to make it easier to randomly place our enemies and food objects.
The last job is to make the walls. We do this by choosing the Draw Walls tool and drawing walls over the top of the places where our character will not be able to move. That means not drawing walls over the ladders.
Now test,
Basic Enemy
The basic enemy just moves left and right, banging into the walls.
Special Enemy
The next enemy will be able to come after us, after a fashion. We only make one of them.
Ouch
We need some code to make sure that the enemies can hurt us.
Test Again
Add some function calls to the existing ON START block. Don't try to add a second one of these events - it won't work properly.
Ghost AI
The AI for the enemy chaser is not perfect, but does make it catch up with you if you stay still for long enough.
Test Again
Better Clothing
The hero sprite changes based on the direction of movement.
Test Again
Food
The following function scatters some food around the level at random.
Test Again
Remember that you are adding to this event, not making it again. This is just to test that the food appears.
Eat Food, Win Game
Be careful here. Othersprite is not a normal variable - don't go making it yourself. Instead, drag it from the function definition block into the place where you want it.
Extensions & Challenges
- You can extend the game quite quickly by using a larger tile map. 64x64 pixels is also possible.
- This is quite a challenging game. It is pretty easy to get snagged on the ladders, particularly when playing on an arcade device. How about having a number of lives at the start and losing a life. Be careful when losing lives that you move the character sprite to a position where it is not going to die again straight away.
- If you do add the lives, think about a way to increase the number of lives with something you can collect. You can define a word for this.
- You can define more than one level and change the tile map when a level is completed. You could define all of your levels as an array of images at the start of the game. You need to cope with the possibility of reaching the last level.
- You could add some sort of projectile to the game. This would allow the player to make some of the hard to access areas a little easier to navigate. It might be interesting to have a finite number of shots, maybe the player should have to collect ammunition (which is in very short supply). You could scatter this around at the start of each level too.
- The missile and enemy shooting could be part of the increasing difficulty of the game. You could make it so that later levels require enemies to be killed in order to be completed.
- You could add some poison items to the game. The player would need to avoid the poison or suffer some in-game consequences.
- A teleporter would be an interesting item. You could do this as a tile in the tile map. Touching a teleporter could teleport you to a random other location with a teleporter. This would be the easiest and most convenient way to implement the feature.
- You could add an immunity shield item as something that can be collected. Add one to the level. When you collect it, change the sprite of the player and set a variable value to reflect the current status. Adapt the enemy collisions to check for this. You also need to think of a way for the immunity to wear off - you could that with game updates.