Can you escape the prison before times runs out! In this Arcade project we create a prison maze that you need to escape before the timer runs out.
Go to the https://arcade.makecode.com website and create a new project.
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)
Click on the gray box in the sprite block to open the Editor. You can choose a sprite from the Gallery or you can paint your own sprite using the Editor.
Add a move (mySprite) with buttons block underneath the set [mySprite] to block so that you can control the movement of the sprite with the arrow buttons.
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) controller.moveSprite(mySprite)
Now add a set tilemap to block inside the on start block and map editor to draw a maze. You will need to draw:
Use whichever tiles you want, if the example we are using tiles from the 'Dungeon' category.
Make sure you leave a path through from the start of the maze to the end!
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) controller.moveSprite(mySprite) tiles.setTilemap(tilemap`level2`)
At the moment you can just walk through the wall tiles of your map.
Use the Draw Walls tool to set which tiles should act as walls and prevent the sprite going through them.
Add a place (mySprite) on top of random block inside the on start block and choose the tile that you set for the start of your maze.
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) controller.moveSprite(mySprite) tiles.setTilemap(tilemap`level2`) tiles.placeOnRandomTile(mySprite, sprites.dungeon.stairLarge)
At the moment if you move your sprite off the screen they will disappear, so add a camera follow sprite (mySprite) block inside the on start block so that the camera follows your sprite wherever it goes.
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) controller.moveSprite(mySprite) tiles.setTilemap(tilemap`level2`) tiles.placeOnRandomTile(mySprite, sprites.dungeon.stairLarge) scene.cameraFollowSprite(mySprite)
Now to make the game challenging we're going to set a time and start a countdown that the player must finish the maze in.
Add a start countdown block inside the on start block and set the amount of seconds you wish to give the player to complete your prison maze.
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) controller.moveSprite(mySprite) tiles.setTilemap(tilemap`level2`) tiles.placeOnRandomTile(mySprite, sprites.dungeon.stairLarge) scene.cameraFollowSprite(mySprite) info.startCountdown(20)
Finially we just need to detect if the sprite gets to the finish tile.
Add the following code and choose the tile that you set as your finish tile.
scene.onOverlapTile(SpriteKind.Player, sprites.castle.tileGrass2, function (sprite, location) { game.over(true, effects.confetti) })
Have fun playing the game! If you want an extra challenge, think about how you could add a second level to the map, what code would you need to add?
Send the completed code to your Arcade handheld computer.
Give your project a name and send it to your Arcade game console (i.e. BrainPad Arcade) by following these steps: