O'Reilly logo

Scratch Cookbook by Brandon Milonovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a maze

Now we'll begin creating a new game. This will be a maze game where the user moves a mouse around the stage and out of the maze.

Getting ready

We need to start off by constructing our stage. Enter the script area for the stage and edit the background as we've done in previous recipes. We have created a very basic maze as shown in the following screenshot. You can get as creative as you like.

Getting ready

We will now need to decide on our sprite that will work its way through the maze, as well as a target.

Import a new sprite. Under the Animals category you'll see a mouse. Create the following set of code within the mouse script area:

These scripts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required