Scratch Maze Game

Follow each step carefully. Do not skip ahead.

Digital Worksheet
Step 1 of 10 Sprites vs Backgrounds
1

Before You Start: Sprites vs Backgrounds

This is the biggest mistake students make — drawing the sprite on the stage.

Maze game infographic

Click the infographic to enlarge

How to use the videos (do this every stage):

You cannot watch the whole video and remember every step. Instead: watch ~30 seconds, pause, then build that section in Scratch. Repeat.

Split your screen so you can see Scratch and the video at the same time.
Windows: open Scratch and the worksheet/video, then press Windows key + Left Arrow to snap one app to the left. Click the other window to fill the right.
If you want Scratch bigger: drag the divider so Scratch takes about 2/3 of the screen and the video takes 1/3.
  • Sprites move and have code
  • Backgrounds (Stage) are the maze levels
  • Sprites use the Costumes tab
  • Backgrounds use the Backdrops tab
If the tab says Backdrops, you are editing the stage — not a sprite.
Screenshot step-01-sprite-vs-stage.png
Sprite vs Stage tabs
3

Set Up the Project

Delete the cat, log in, and name your project so it saves properly.

  • Log in to Scratch
  • Name the project: Maze Game
  • Delete the Scratch cat sprite
Screenshot step-03-name-delete-cat.png
Name project and delete cat
2

Create a Sprite the Correct Way

Important: HOVER over the cat icon to reveal the paintbrush. Don’t click it directly.

  1. Go to the Sprite area (bottom-right)
  2. HOVER over the cat face
  3. Click the paintbrush (not the sprite library)
If a big library of premade sprites opens, you clicked (wrong). Close it and hover instead.
Screenshot step-02-hover-paintbrush.png
Hover cat icon for paintbrush
4

Draw the Player Sprite

Make a square sprite and centre it perfectly on the crosshair.

  • Go to Costumes
  • Outline: Invisible
  • Fill: choose a colour (e.g., red)
  • Hold SHIFT to draw a perfect square
  • Move the square so its centre sits on the crosshair
  • Check: Tab says Costumes (if it says Backdrops, you’re on the stage)
  • Use the magnifying glass to zoom in if it’s fiddly
  • If the sprite looks ‘wonky’ when moving, re-centre it on the crosshair
If it isn’t centred, your sprite will move “wonky”.
Screenshot step-04-centre-crosshairs.png
Centre sprite on crosshair
5

Add Basic Movement Code

Green flag starts movement + arrow keys change direction.

  • Events: when green flag clicked
  • Motion: go to x/y (start position)
  • Motion: point in direction
  • Control: forever → Motion: move 2 steps
  • Four IF blocks (not nested) for arrow keys → change direction
  • Move the sprite to your start position in the Code window (not in Costumes)
  • Use the go to x/y block so it always resets to the same start point
  • If it’s too fast, lower the move steps number (e.g., 2)
  • Duplicate the IF blocks and snap them directly underneath (don’t put them inside each other)
Don’t put the arrow-key IF blocks inside each other. Stack them underneath.
Screenshot step-06-movement-code.png
Movement code blocks
6

Create Level Backdrops

Make three maze levels on the Stage (Backdrops tab), each with a different finish square colour.

  • Click StageBackdrops
  • Create: Level 1, Level 2, Level 3
  • Walls: one wall colour (same across all levels)
  • Finish: different colour square at the end of each level
  • Levels should get harder each time
  • Wall colour must be different to your sprite colour (or it will constantly reset later)
  • Keep the same wall colour across all levels (don’t add extra colours to the walls)
  • Use arrow keys to nudge shapes into position neatly
  • Test each level: can your sprite actually fit through the gaps?
Screenshot step-08-wall-finish-colours.png
Backdrops levels
7

Broadcasts: Level Switching + Reset on Wall

Touching wall resets. Touching finish broadcasts “Level 2 / Level 3 / Winner”.

  • Looks: switch backdrop to Level 1 at start
  • IF touching wall colour → go back to start
  • IF touching finish colour → broadcast Level 2/3/Winner
  • Use the pipette to pick colours exactly
  • Add broadcasts: Level 2, Level 3, and Winner (create new message each time)
  • After broadcasting: wait 1 secondgo to startswitch backdrop
  • Create receiver scripts: when I receive Level 2 and when I receive Level 3
  • For colour checks: click the colour square → use the pipette (don’t try to match it by eye)
Screenshot step-08-wall-finish-colours.png
Touching colour with pipette
8

Winner Backdrop

Make a “Winner” backdrop and switch to it when the game is completed.

  • Create new backdrop: Winner
  • Text tool: write “WINNER”
  • On Winner broadcast: switch backdrop → wait 4 seconds → switch back to Level 1
  • Rename the backdrop to Winner (so it matches your code dropdown)
  • After switching to Winner: wait 4 seconds so the player can see their result
  • Then switch back to Level 1 so the game restarts
Screenshot step-12-broadcast-scripts.png
Broadcast scripts
9

Add Obstacles (Hide / Show by Level)

Obstacles should only appear on certain levels using broadcasts.

  • Create obstacle sprite (rectangle)
  • Use wall colour (pipette) so it “matches”
  • When I receive Level 1 → hide
  • When I receive Level 2 → show + spin (slowly)
  • When I receive Level 3 / Winner → hide
  • At the top of your main code: broadcast Level 1 (so obstacles know the game has started)
  • On obstacles: Level 1 hide, Level 2 show, Level 3 hide, Winner hide
  • Make it fair: slow the spin (e.g., turn 1 degree)
Screenshot step-16-obstacle-spin.png
Obstacle hide/show code
10

Add a Score

Make a variable called Score and increase it when each level is completed.

  • Variables → Make a variable: Score
  • At start: set Score to 0
  • At each finish: change Score by 1
  • Challenge: Why might it not reset after Winner?
  • Make sure set score to 0 is under the green flag
  • Put change score by 1 inside each finish-colour IF block (before long waits)
  • Challenge: if score doesn’t reset after Winner, where else could you set it back to 0?
Screenshot step-19-score-bug.png
Score variable blocks
11

Extension Challenges (Choose Your Own)

Add one extra feature using variables and IF statements. Test and debug it properly.

Extension tasks: Choose one challenge and finish it properly (then move up a tier). Keep testing so your maze still works.

Bronze (Accessible)

🟩 Key and Door (Single Level) — Add a key that must be collected before the door lets you finish the level.
  • Create a key sprite.
  • Create a variable called has key (for all sprites).
  • When the player touches the key:
    • Hide the key
    • Set has key to yes
  • At the door:
    • If touching door and has key = yes → finish the level
    • Else say: “You need the key!” (optional)
Hint: If your door won’t open, check you set has key to yes when you touch the key, and reset it back to no when you restart or change level.
🟩 Timer Challenge — Add a countdown timer. Reach the exit before time runs out.
  • Create a variable called time.
  • At level start, set time to 30 (or 20).
  • Create a timer script:
    • Repeat until finished:
      • Wait 1 second
      • Change time by -1
      • If time = 0 → broadcast restart
Hint: If the timer goes down too fast, you might have started it twice. Keep the countdown in one place (one sprite / one script).

Silver (Requires planning)

🟦 Enemy That Moves (Patrol) — Add an enemy that patrols and sends the player back if touched.
  • Create an enemy sprite (simple shape is fine).
  • Make it move left/right (or up/down) in a loop.
  • Use wall detection to turn around:
    • If touching wall colour → turn 180 degrees
  • If the enemy touches the player → broadcast restart.
Hint: Keep the enemy code on the enemy sprite. That makes it easier to fix if something breaks.
🟦 Destructible Wall — Add a wall that disappears only after collecting an item (switch / bomb / button).
  • Create a wall sprite that blocks a shortcut.
  • Create a switch/bomb/button sprite somewhere else.
  • Create a variable wall open set to no at level start.
  • When player touches the switch:
    • Set wall open to yes
    • Hide the switch (optional)
  • Wall sprite checks:
    • If wall open = yes → hide
    • Else → show
Hint: If the wall stays gone (or never disappears), check your variable. Reset wall open when you restart or when the level starts.

Gold (Stretch / mastery)

🟨 Multiple Keys, Multiple Doors — Add more than one key and door pair (e.g., red key opens red door).
  • Option A: make variables red key, blue key (values yes/no).
  • Option B: make one variable key (values none/red/blue).
  • Each door checks the matching condition before allowing progress.
  • Reset your key variables when restarting or changing level.
Hint: If a door opens when it shouldn’t, double-check your IF condition and your variable names. Reset your key variables when you restart.
🟨 Enemy With “AI” Behaviour — Create an enemy that follows the player when nearby (otherwise it patrols).
  • Enemy runs a loop forever.
  • If distance to player < 120:
    • Point towards player
    • Move slowly (e.g., 1–2 steps)
  • Else:
    • Patrol like a normal enemy (turn at walls)
  • If touching player → broadcast restart.
Hint: Start simple: make it chase first. If that works, then add patrol behaviour when the player is far away.

Platinum (Open-ended)

🟪 Choice-Based Maze (Fork with Consequences) — Add a fork in the maze where each path has different risks or rewards.
  • Path A is shorter but has an enemy; Path B is longer but safe.
  • Path A contains the key; Path B is a shortcut but needs the key later.
  • Path A gives bonus points; Path B removes time from the timer.
Hint: Playtest both routes. Does one path feel unfair? If so, tweak the risk/reward and test again.
🟪 Self-Check (Use for Any Challenge) — Use this checklist to prove your extension is complete.
  • My maze still works (movement + walls + finish).
  • I tested my new feature at least 3 times.
  • I can explain which variable(s) I used and what they store.
  • I can explain at least one condition (IF) in my code.
  • I reset everything properly on restart / new level.
Teacher note Extension tasks

Success criteria:

  • Your original maze still works (movement + walls + finish + levels).
  • Your new feature is reliable (tested at least 3 times).
  • You can explain your code using: variable, condition, broadcast, loop.
If it breaks, undo your last change and try again. One change at a time.