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.

MakeCode Arcade Code

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,

MakeCode Arcade Code

Level Design

MakeCode Arcade Code

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.

MakeCode Arcade Code

Then, click on MyTiles, click the + to add a new tile. Choose to edit this new tile,

MakeCode Arcade Code

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.

MakeCode Arcade Code

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.

MakeCode Arcade Code

Now test,

MakeCode Arcade Code

Basic Enemy

The basic enemy just moves left and right, banging into the walls.

MakeCode Arcade Code

Special Enemy

The next enemy will be able to come after us, after a fashion. We only make one of them.

MakeCode Arcade Code

Ouch

We need some code to make sure that the enemies can hurt us.

MakeCode Arcade Code

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.

MakeCode Arcade Code

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.

MakeCode Arcade Code

Test Again

MakeCode Arcade Code

Better Clothing

The hero sprite changes based on the direction of movement.

MakeCode Arcade Code

Test Again

MakeCode Arcade Code

Food

The following function scatters some food around the level at random.

MakeCode Arcade Code

Test Again

Remember that you are adding to this event, not making it again. This is just to test that the food appears.

MakeCode Arcade Code

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.

MakeCode Arcade Code

Extensions & Challenges

  1. You can extend the game quite quickly by using a larger tile map. 64x64 pixels is also possible.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. You could add some poison items to the game. The player would need to avoid the poison or suffer some in-game consequences.
  8. 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.
  9. 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.