Wikijunior:Raspberry Pi/Scratch Game – Simple Maze
Tutorial by Andrew Oakley
Updated Nov 2017
Getting started[edit | edit source]
- Click on the Raspberry menu, Programming, Scratch
- Click the Maximise Window button.
- Select File menu, Open.
- Click the Pi button.
- Select Scratch and click OK.
- Select simple-maze and click OK.
- Select smaze1 and click OK. A green and blue maze should appear.
You should now be able to move the Smiley left and right, using the left and right arrow keys.
X is a "variable". A variable can hold a number or a word which can change. X measures left and right position.
You should now be able to move the Smiley up and down, using the up and down arrow keys. The Y variable measures up and down position.
The Smiley can now move anywhere around the maze, including through the walls.
We need to add rules:
- To make the Smiley go back to the start if it hits a blue wall
- To say "You win!" if the Smiley reaches the white outline of the exit
Create this new block.
To select a colour:
- Click the colour box
- Click the colour you need
To start a new game:
Click the green flag
What if you make a mistake?
Right-click any block and click "delete"
For teachers / Scout / Guide leaders[edit | edit source]
Downloads available from http://www.cotswoldjam.org/downloads/beavers
To add the files to Raspbian, go to the terminal:
cd mkdir -p Scratch/simple-maze cd Scratch/simple-maze curl "http://www.cotswoldjam.org/downloads/beavers/cjam-scratch-simple-maze-code.zip" -O unzip cjam-scratch-simple-maze-code.zip exit
-O is the capital letter O, not zero.