In other words, x is the sprite’s horizontal position. The x-coordinate (also called x position) is a number that represents how far left or right a sprite is on the Stage. Coordinates are numbers that represent an exact location. To make the cat move around the Stage, you need to use coordinates. In Part A, you’ll set up the code to control the cat with the arrow keys on the keyboard. In the Maze Runner game, the player will control the cat sprite. In the text field in the upper left, rename the project from Untitled to Maze Runner. If you want to create everything on your own, click File ▶ New to start a new Scratch project. This file contains the maze images you’ll use in this chapter.
Click File ▶ Load from your computer in the Scratch editor to load the maze-skeleton.sb3 file.Įven if you don’t use the skeleton project, you should download the ZIP file from the website. The skeleton project file has all the sprites already loaded, so you’ll only need to drag the code blocks into each sprite. Go to and download the ZIP file to your computer by right-clicking the link and selecting Save link as or Save target as. This file has parts of the project already set up and only needs the code blocks added to it.
If you want to save time, you can start from the skeleton project file, named maze-skeleton.sb3, in the resources ZIP file. (I never apologize for my puns.) My sketch for the maze game looks like the following figure.
With some planning, you can make your maze game a-maze-ing. Sketch Out the Designįirst, draw what you want the game to look like on paper.
In this chapter, you’ll create a game that lets the player guide a cat through a maze to reach its goal-a delicious apple! You’ll learn how to move the cat with the keyboard and how to block its progress with walls.īefore you start coding, take a look at the final program. Ou’ve probably played a maze game before, but have you ever tried making one? Mazes can be tricky to complete, but they’re easy to program.