Today you are working in MakeCode Arcade. You will plan a maze escape, then build Prison Break step by step at your device: predict, build, run and fix.
You can already create sprites and move them. Today you add walls, a goal and a win condition, plus a short timer so the escape has pressure.
Before you run anything, think: what should happen when your player reaches the goal tile, and what should stop them walking through walls?
Keep this short. Devices on MakeCode Arcade, students logged in. Optional predict: before anyone runs code, ask what should happen at walls and at the goal. Do not list build steps here. Note that pairs will sketch the maze before heavy tilemap work. Move quickly into the project so time stays on the build.
Welcome to the 'Prison Break' game creation lesson! In this lesson, you will learn how to create a fun and exciting maze game using MakeCode Arcade. You will create a character, design a maze for the character to navigate, and set a goal for the character to reach. You will also learn how to add a timer to make the game more challenging. Let's get started and have some fun!
Frame this as the overview only. Stress that planning the path and goal comes before polishing art. Ask what a maze needs (blocked paths, one clear goal, fair challenge). No code on the board yet.
Go to the https://arcade.makecode.com website and create a new project.
Model creating a new Arcade project on the board. Check every pair has a fresh project named in the class style. Watch for students opening the wrong MakeCode product (not Arcade).
First, switch the editor to JavaScript. This studio is written in text rather than blocks. At the top of the MakeCode Arcade editor there is a toggle that says Blocks | JavaScript. Click JavaScript and type the code below into the editor.
It is the same program either way. Flip back to Blocks whenever you like and you will see the code you typed as blocks, which is a good way to check you have it right. If a line will not go in, check the brackets and the capital letters, text is fussier than blocks.
Next create a sprite for your character that you will control and navigate through the maze.
Add the following code to your project and then design a character using the sprite editor.
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . 7 7 . . . . . . . .
. . . . 7 7 7 7 7 . . . . . . .
. . . . 7 7 7 5 7 7 . . . . . .
. . . . 7 7 7 7 7 7 . . . . . .
. . . . 7 7 7 7 7 7 . . . . . .
. . . . . . 7 7 . . . . . . . .
. . . . . . 7 7 . . . . . . . .
. . . . . 7 7 7 7 7 . . . . . .
. . . . . . 7 . . . . . . . . .
. . . . . . 7 . . . . . . . . .
. . . . . 7 7 7 . . . . . . . .
. . . . 7 7 . 7 7 . . . . . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
Now let's control our player with the buttons.
Add the following new code:
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . 7 7 . . . . . . .
. . . . . 7 7 7 7 7 7 . . . . .
. . . . . 7 7 7 7 7 7 . . . . .
. . . . . 7 7 7 . 7 7 . . . . .
. . . . . 7 7 7 7 7 7 . . . . .
. . . . . 7 7 7 7 7 7 . . . . .
. . . . . . 7 7 7 7 . . . . . .
. . . . . . . 7 . . . . . . . .
. . . . 7 7 7 7 7 7 7 . . . . .
. . . . . . . 7 . . . . . . . .
. . . . . . . 7 . . . . . . . .
. . . . . . 7 7 7 7 7 . . . . .
. . . . . 7 7 . . . 7 7 . . . .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
Model controller movement on the board. Ask what should happen when a direction button is held. Common bug: movement code not attached to the player sprite, or sprite kind mismatch. Have pairs run once so they feel free movement before walls exist.
You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.