Guided Class Project

Complete downloadable pilot

Escape from the Giant Pigeon

Reach a safe place while a huge, unreasonable pigeon chases you across the map. The game should be funny to play and precise enough to explain.

  • Coordinates
  • Movement
  • Conditions
  • Collision
  • Game State
  • Debugging

Finished-game summary

A small chase with rules you can explain.

Guide the Player from the lower-left corner to the striped Safe Zone while a comically oversized pigeon closes in. The arrow keys change x and y, the explicit game state prevents conflicting endings, and R performs the same complete reset as the green flag.

Controls

  • Arrow keys — move the Player on the x and y axes
  • Green flag — stop the old run and start from known state
  • R key — reset positions, variables, costumes, timer, and messages
Paper-textured chase stage with a start corner and striped shelter
Cover/stage artwork — provisional School of Code project artwork.

Project system sketch

See the whole game before assembling it.

Letters A–F connect stage positions, movement, pursuit, collision priority, the Panic meter, and the state flow.

Inventor notebook diagram of the chase game systems
Technical project sketch — provisional School of Code project artwork.
  1. READY resets every actor and gives the player a fair one-second look at the stage.
  2. PLAYING enables movement, pursuit, the timer, panic, and collision checks.
  3. Pigeon contact wins collision priority and changes the state to CAUGHT.
  4. Safe Zone contact is accepted only when the Player is not touching the pigeon, then changes the state to SAFE.
  5. R or a new green-flag click returns the whole project to READY.

What you need

A browser, Scratch, and room to test.

  • A browser
  • The Scratch editor
  • A keyboard
  • A student-drawn character or ordinary built-in Scratch assets

No installation is required where browser-based Scratch is available. Saving and sharing options depend on account and classroom setup; account creation is not assumed by this project.

What is already in the starter

  • Original backdrop and seven editable SVG costumes
  • Three small generated WAV effects
  • Named variables and visible monitors
  • Known positions and setup receivers
  • In-editor build instructions

What you still build

  • Arrow-key movement and boundaries
  • Pursuit and fair timing
  • Caught-first collision priority
  • Panic and survival displays
  • SAFE / CAUGHT feedback and R restart

Project downloads

Start Building

Each download is generated from original repository sources and checked before it reaches this panel.

Scratch 3 project (.sb3)53.5 KB

Download Starter Project

Original art, sounds, variables, known positions, and setup scripts—without the completed game systems.

Download Starter Project escape-from-the-giant-pigeon-starter.sb3
Scratch 3 project (.sb3)55.3 KB

Download Finished Reference

The complete playable reference used by every code section on this page.

Download Finished Reference escape-from-the-giant-pigeon-finished.sb3
ZIP archive (.zip)54.3 KB

Download Art and Sound Pack

Human-readable original SVG costumes, backdrop, WAV effects, sketch, README, and licence notes.

Download Art and Sound Pack escape-from-the-giant-pigeon-assets.zip

Systems you will build

Ten small systems, one coherent loop.

Build in order. Test each system before adding the next one.

  1. 01Reset the game
  2. 02Move the player
  3. 03Keep the player on stage
  4. 04Start the pigeon
  5. 05Chase the player
  6. 06Detect being caught
  7. 07Detect reaching safety
  8. 08Update the panic meter
  9. 09End the game cleanly
  10. 10Restart and test
01

Build system

Reset the game

Creates one reliable starting state for every run.

Plain-language logic

The flag asks for Reset Game. That receiver sets READY first, restores every variable, resets the timer, waits for every actor to reset, then begins PLAYING after a fair pause.

System pseudocode

ON green flag:
    ask the whole project to reset
ON Reset Game:
    set READY and restore every value
    reset every actor
    wait for a fair start
    set PLAYING
StageScript: stage-green-flag
when green flag clicked
broadcast [Reset Game v] and wait
View editable scratchblocks text
when green flag clicked
broadcast [Reset Game v] and wait
StageScript: stage-reset-game
when I receive [Reset Game v]
set [Game State v] to [READY]
stop all sounds
set [Panic v] to (0)
set [Survival Time v] to (0)
set [Pigeon Speed v] to (2)
reset timer
broadcast [Reset Actors v] and wait
wait (1) seconds
set [Game State v] to [PLAYING]
play sound [start v] until done
View editable scratchblocks text
when I receive [Reset Game v]
set [Game State v] to [READY]
stop all sounds
set [Panic v] to (0)
set [Survival Time v] to (0)
set [Pigeon Speed v] to (2)
reset timer
broadcast [Reset Actors v] and wait
wait (1) seconds
set [Game State v] to [PLAYING]
play sound [start v] until done
PlayerScript: player-reset
when I receive [Reset Actors v]
set rotation style [left-right v]
go to x: (-190) y: (-110)
switch costume to [normal v]
show
say []
View editable scratchblocks text
when I receive [Reset Actors v]
set rotation style [left-right v]
go to x: (-190) y: (-110)
switch costume to [normal v]
show
say []
Safe ZoneScript: safe-zone-reset
when I receive [Reset Actors v]
go to x: (190) y: (-115)
switch costume to [inactive v]
show
View editable scratchblocks text
when I receive [Reset Actors v]
go to x: (190) y: (-115)
switch costume to [inactive v]
show
What to test
Click the green flag three times from different endings. The same positions and values must return each time.
Common mistake
Setting PLAYING before the sprites have moved back lets collision code read stale positions.
Teacher checkpoint
Ask the student why Reset Actors uses broadcast and wait instead of an ordinary broadcast.
02

Build system

Move the player

Reads all four arrow keys and changes one coordinate at a time.

Plain-language logic

Movement runs only in PLAYING. Right and left change x; up and down change y. Separate checks allow diagonal movement when two keys are held.

System pseudocode

WHILE the game is playing:
    read the arrow keys
    change x for left or right
    change y for up or down
PlayerScript: player-movement
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <key [right arrow v] pressed?> then
            change x by (5)
        end
        if <key [left arrow v] pressed?> then
            change x by (-5)
        end
        if <key [up arrow v] pressed?> then
            change y by (5)
        end
        if <key [down arrow v] pressed?> then
            change y by (-5)
        end
    end
end
View editable scratchblocks text
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <key [right arrow v] pressed?> then
            change x by (5)
        end
        if <key [left arrow v] pressed?> then
            change x by (-5)
        end
        if <key [up arrow v] pressed?> then
            change y by (5)
        end
        if <key [down arrow v] pressed?> then
            change y by (-5)
        end
    end
end
What to test
Hold one key at a time, then hold two together. Each axis should change in the expected direction.
Common mistake
Using change y for left/right or reversing the negative signs.
Teacher checkpoint
Have the student predict the new coordinate before pressing each arrow once.
03

Build system

Keep the player on stage

Clamps the Player to a readable rectangle inside the Scratch stage.

Plain-language logic

Four comparisons inspect the live x and y positions. If an edge is exceeded, the matching coordinate is set exactly to that edge.

System pseudocode

FOREVER during PLAYING:
    if x passes either side, put x on the edge
    if y passes top or bottom, put y on the edge
PlayerScript: player-boundaries
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <(x position) > (218)> then
            set x to (218)
        end
        if <(x position) < (-218)> then
            set x to (-218)
        end
        if <(y position) > (158)> then
            set y to (158)
        end
        if <(y position) < (-158)> then
            set y to (-158)
        end
    end
end
View editable scratchblocks text
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <(x position) > (218)> then
            set x to (218)
        end
        if <(x position) < (-218)> then
            set x to (-218)
        end
        if <(y position) > (158)> then
            set y to (158)
        end
        if <(y position) < (-158)> then
            set y to (-158)
        end
    end
end
What to test
Hold every arrow key against every boundary, including two diagonal corners.
Common mistake
Checking an x boundary and accidentally setting y.
Teacher checkpoint
Ask why the limits are smaller than the stage coordinates -240/240 and -180/180.
04

Build system

Start the pigeon

Restores the dramatic pigeon to a known, distant starting zone.

Plain-language logic

Reset Actors restores position, direction, costume, and visibility. The Stage remains in READY for one second before pursuit can run.

System pseudocode

ON Reset Actors:
    stop any old chase appearance
    move far from the Player
    face left, show wings up, and show
Giant PigeonScript: pigeon-reset
when I receive [Reset Actors v]
set rotation style [all around v]
go to x: (155) y: (100)
point in direction (-90)
switch costume to [wings up v]
show
View editable scratchblocks text
when I receive [Reset Actors v]
set rotation style [all around v]
go to x: (155) y: (100)
point in direction (-90)
switch costume to [wings up v]
show
What to test
Move and repaint the pigeon during a run, restart, and confirm all its starting properties return.
Common mistake
Resetting only the position while an ending costume or hidden state remains.
Teacher checkpoint
Measure the visual distance between the two known starts before PLAYING begins.
05

Build system

Chase the player

Uses one transparent pursuit rule: point toward the Player and move by Pigeon Speed.

Plain-language logic

The forever loop re-aims because the Player keeps moving. A short wait controls speed and makes the two wing costumes readable.

System pseudocode

WHILE the game is PLAYING:
    point toward the Player's current position
    move by Pigeon Speed
    flap once and pause briefly
Giant PigeonScript: pigeon-chase
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        point towards [Player v]
        move (Pigeon Speed) steps
        next costume
        wait (0.08) seconds
    end
end
View editable scratchblocks text
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        point towards [Player v]
        move (Pigeon Speed) steps
        next costume
        wait (0.08) seconds
    end
end
What to test
Move in a large rectangle and confirm the pigeon continually corrects its direction.
Common mistake
Pointing toward the Player once before the loop instead of during every chase step.
Teacher checkpoint
Ask which single variable can make the chase easier or harder without rewriting it.
06

Build system

Detect being caught

Changes the state to CAUGHT exactly once when the Player touches the Giant Pigeon.

Plain-language logic

The outer state check prevents repeated endings. State changes before the broadcast, so every other PLAYING system stops on its next check.

System pseudocode

WHILE PLAYING:
    if touching the Giant Pigeon:
        set CAUGHT first
        announce Caught
PlayerScript: player-detect-caught
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <touching [Giant Pigeon v]?> then
            set [Game State v] to [CAUGHT]
            broadcast [Caught v]
        end
    end
end
View editable scratchblocks text
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <touching [Giant Pigeon v]?> then
            set [Game State v] to [CAUGHT]
            broadcast [Caught v]
        end
    end
end
What to test
Let the pigeon touch the Player from several directions and confirm CAUGHT appears once.
Common mistake
Broadcasting the ending before changing state allows another detector to run as if play continues.
Teacher checkpoint
Pause on the contact frame and ask which command prevents a second ending.
07

Build system

Detect reaching safety

Awards SAFE only when the Player reaches the shelter without pigeon contact.

Plain-language logic

The not-touching-pigeon guard gives CAUGHT priority in an overlap that looks simultaneous. Only then does the script inspect the Safe Zone.

System pseudocode

WHILE PLAYING:
    if NOT touching the pigeon:
        if touching the Safe Zone:
            set SAFE first
            announce Reached Safety
PlayerScript: player-detect-safe
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <not <touching [Giant Pigeon v]?>> then
            if <touching [Safe Zone v]?> then
                set [Game State v] to [SAFE]
                broadcast [Reached Safety v]
            end
        end
    end
end
View editable scratchblocks text
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        if <not <touching [Giant Pigeon v]?>> then
            if <touching [Safe Zone v]?> then
                set [Game State v] to [SAFE]
                broadcast [Reached Safety v]
            end
        end
    end
end
What to test
Reach the shelter cleanly, then drag the pigeon over it and test the overlap priority.
Common mistake
Testing safety without excluding pigeon contact makes the ending depend on script timing.
Teacher checkpoint
Ask the student to explain the nested condition in one sentence.
08

Build system

Update the panic meter

Turns distance into a 0–100 Panic value and records survival time.

Plain-language logic

Nearby pigeons create higher Panic. Two boundary checks keep the meter sensible. A separate Stage script rounds the timer to tenths while PLAYING.

System pseudocode

WHILE PLAYING:
    Panic = 100 - rounded(distance / 4)
    clamp Panic between 0 and 100
    Survival Time = timer rounded to tenths
PlayerScript: player-panic
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        set [Panic v] to ((100) - (round ((distance to [Giant Pigeon v]) / (4))))
        if <(Panic) < (0)> then
            set [Panic v] to (0)
        end
        if <(Panic) > (100)> then
            set [Panic v] to (100)
        end
    end
end
View editable scratchblocks text
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        set [Panic v] to ((100) - (round ((distance to [Giant Pigeon v]) / (4))))
        if <(Panic) < (0)> then
            set [Panic v] to (0)
        end
        if <(Panic) > (100)> then
            set [Panic v] to (100)
        end
    end
end
StageScript: stage-survival-time
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        set [Survival Time v] to ((round ((timer) * (10))) / (10))
    end
end
View editable scratchblocks text
when green flag clicked
forever
    if <(Game State) = [PLAYING]> then
        set [Survival Time v] to ((round ((timer) * (10))) / (10))
    end
end
What to test
Watch Panic at the far start, during approach, and on contact; restart and verify both values return to zero.
Common mistake
Dividing 100 by distance instead of subtracting scaled distance makes the meter jump unpredictably.
Teacher checkpoint
Ask why a game can display an approximate meter even though collision still uses direct touching.
09

Build system

End the game cleanly

Shows one clear result using costume, sound, speech, and Safe Zone feedback.

Plain-language logic

Ending receivers do presentation work after the detector has committed the game state. Chase and movement stop because they are gated by PLAYING.

System pseudocode

ON Caught:
    show caught costume and sound
    explain how to restart
ON Reached Safety:
    activate the shelter and play its sound
    explain how to restart
PlayerScript: player-caught-response
when I receive [Caught v]
switch costume to [caught v]
play sound [caught v] until done
say [CAUGHT! Press R to restart.]
View editable scratchblocks text
when I receive [Caught v]
switch costume to [caught v]
play sound [caught v] until done
say [CAUGHT! Press R to restart.]
PlayerScript: player-safe-response
when I receive [Reached Safety v]
say [SAFE! Press R to restart.]
View editable scratchblocks text
when I receive [Reached Safety v]
say [SAFE! Press R to restart.]
Safe ZoneScript: safe-zone-active-response
when I receive [Reached Safety v]
switch costume to [active v]
play sound [safe v] until done
View editable scratchblocks text
when I receive [Reached Safety v]
switch costume to [active v]
play sound [safe v] until done
What to test
Trigger each ending and verify the other sound, costume, and state never appears.
Common mistake
Using stop all before displaying the result prevents ending feedback and restart scripts.
Teacher checkpoint
Ask which scripts stop because of state, even though no stop block is used.
10

Build system

Restart and test

Routes the R key through the same complete Reset Game system as the flag.

Plain-language logic

There is one reset definition, so fixes apply to both start paths. R works after a win, after a loss, or during play.

System pseudocode

ON R key:
    ask for Reset Game and wait
THEN test green flag, win-restart, caught-restart, edges, overlap, and variables
StageScript: stage-r-restart
when [r v] key pressed
broadcast [Reset Game v] and wait
View editable scratchblocks text
when [r v] key pressed
broadcast [Reset Game v] and wait
What to test
Run every item in the page checklist, including three repeated flag clicks and both ending-to-R paths.
Common mistake
Duplicating the reset commands under R eventually makes the two restart paths disagree.
Teacher checkpoint
Student demonstrates one repaired bug and identifies the test that now catches it.

Test checklist

Try the awkward cases on purpose.

Do not call the project finished after one easy win.

  1. Click the green flag three times; each run starts at the same positions with READY before PLAYING.
  2. Win, press R, and confirm positions, variables, timer, costumes, visibility, and speech reset.
  3. Get caught, press R, and confirm the Player returns to the normal costume.
  4. Hold each arrow key at every stage edge; the Player remains between x -218/218 and y -158/158.
  5. Confirm the pigeon starts at x 155, y 100 while the Player starts at x -190, y -110.
  6. Enter the Safe Zone without pigeon contact; the state becomes SAFE exactly once.
  7. Force an overlap near the Safe Zone; pigeon contact produces CAUGHT, never both endings.
  8. Change each visible variable, restart, and confirm Game State, Panic, Survival Time, and Pigeon Speed reset.
  9. Hide or change a sprite costume in the editor, then restart; every actor becomes visible in its initial costume.

Debugging guide

The Player travels off screen

Check all four boundary comparisons and confirm x rules set x while y rules set y.

The pigeon catches the Player immediately

Inspect both reset positions and make sure pursuit only runs while Game State equals PLAYING.

SAFE and CAUGHT seem to happen together

Keep the not-touching-pigeon guard around the Safe Zone check and set state before broadcasting the ending.

R leaves an old message or costume

Every sprite needs a Reset Actors receiver that restores costume, visibility, and speech as well as position.

Panic rises in the wrong direction

The formula subtracts scaled distance from 100; then two checks clamp the result to 0–100.

Improve the system

Change the idea without breaking the reset.

BUILDER CHALLENGE

Make the chase fair at a new speed.

Change Pigeon Speed to 3, test three routes, and adjust one starting coordinate until the game remains fair.

INVENTOR CHALLENGE

Give Panic a second influence.

Add sandwich crumbs that reduce Panic without changing Game State. Explain how each crumb can trigger only once.

BOSS LEVEL

Build a second stateful map.

Create a second original backdrop with a new Safe Zone location. Reset the stage number, actor positions, and collision rules without duplicating the whole game.

What to demonstrate

Show the code making a decision.

Explain one coordinate change, one state transition, one edge-case test, and one improvement you made.

  • A known start
  • Working x/y controls
  • A win
  • A loss
  • One bug that was fixed
  • One personal modification

Artwork and independence note

Original, editable, and deliberately provisional.

The sketch-style vectors, layout slots, and palette are production-ready placeholders for this pilot. A human illustrator can refine them later without changing sprite names, costume centres, scripts, downloads, or the reusable curriculum model.

Scratch is a project of the Scratch Foundation. School of Code is an independent educational project and is not affiliated with or endorsed by the Scratch Foundation.