Scratch Project · Grade 5 · Chapter 8
Scratch Mini-Game Part 2: Polish & Scoring
Completing "Space Dodger" — adding collisions, lives, scoring system, broadcasts, and Game Over sound FX!
Learning Goals
What We'll Finish Today
GOAL 1
Collision Sensing
Detect when asteroids hit the player and subtract lives with temporary invincibility.
GOAL 2
Broadcast Messages
Use broadcast [Game Over v] to signal all sprites to stop and switch screens.
GOAL 3
Sound & Polish
Add retro sound effects, score counters, and win/loss backdrops.
Project Recap
What We Built in Part 1
In Part 1, we got Astro-Cat moving smoothly and built the infinite falling asteroid loop. But right now, asteroids pass through Astro-Cat without doing anything!
Today's Goal: Turn our animation into a real, challenging arcade game!
Game Design Story
Making Games Feel Alive
Great games give instant feedback when something important happens — a screen flash, a sound effect, or a score pop-up!
Today we add player lives, collision flashes, explosion sounds, and high score tracking!
Core Concept
Collision Detection Physics
Inside the Asteroid script, we check every frame: "Am I touching Astro-Cat right now?"
if <touching [AstroCat v]?> then {
change [lives v] by (-1)
play sound [Boom v]
set y to (180) // Reset asteroid back to top
wait (0.5) seconds // Invincibility delay!
}
Game Physics Secret
Why We Need Invincibility Frames
1
Collision Hit
Asteroid touches Astro-Cat.
2
Subtract 1 Life
Lives goes from 3 to 2.
3
Pause / Respawn
Asteroid teleports top & waits 0.5s so 3 lives don't vanish in 1 frame!
Scoring Mechanics
How Survival Scoring Works
Every time an asteroid safely reaches the bottom of the screen without hitting the player, award +10 points!
if <y position < -170> then {
change [score v] by (10)
play sound [Pop v]
set y to (180)
}
Core Concept
What is a Scratch Broadcast?
A Broadcast is like a radio announcement sent to all sprites and backdrops at once!
📢 Sender Sprite
if then broadcast [Game Over v]
📻 Receiver Sprite / Stage
when I receive [Game Over v] ➔ switch backdrop to [GameOverScreen v], stop [all v]
Visual Flow
The Game Over Chain Reaction
1
Lives Hit 0
Player loses last heart.
2
Broadcast Sent
broadcast [Game Over v] fires.
3
Stage Reacts
Backdrop changes, Game Over sound plays, game freezes.
Stage Code
Stage Game Manager Script
when green flag clicked
switch backdrop to [Space v]
set [score v] to (0)
set [lives v] to (3)
when I receive [Game Over v]
switch backdrop to [Game Over Screen v]
play sound [Lose Sound v] until done
stop [all v]
Side-by-Side Comparison
Raw Prototype vs. Polished Arcade Game
❌ RAW PROTOTYPE
- No sound effects or visual feedback
- Sprites just freeze silently when lost
- No high score display
✅ POLISHED ARCADE GAME
- Retro sound FX on jump, hit, and score
- Clean Game Over screen with final score
- Invincibility flash effect on hit
Debunking Myths
The 0-Life Multi-Death Bug
Glitch: When player hits asteroid, lives go from 3 to 0 instantly!
Fix: You must reset the asteroid's position or add wait 0.5 secs inside the collision block so the sprite doesn't register 30 touches per second!
Smartboard Voting
Which Broadcast Block to Use?
We want the Stage to wait until the Game Over sound finishes before stopping all scripts.
Option A: broadcast [Game Over v]
Option B: broadcast [Game Over v] and wait
Vote: Thumbs UP for Option A, Thumbs DOWN for Option B!
Spot the Bug
Why Is the High Score Vanishing?
when green flag clicked ➔ set [HighScore v] to (0)
Bug Analysis: Why should HighScore NOT be reset to 0 at green flag click? What variable SHOULD reset to 0 instead?
Think-Pair-Share
Adding Star Power-Ups
Design a golden Star sprite that falls from top twice per game!
Partner Task: IF Astro-Cat touches the Star, what cool effect should happen? (+1 Extra Life? 5 seconds of invincibility? +50 points?)
Guided Practice
Connecting Broadcasts & Sounds Live
Let's finish the game scripts live on the smartboard!
- Step 1: Add score (+10) on safe asteroid drop.
- Step 2: Add collision check (-1 life & boom sound).
- Step 3: Create Game Over backdrop & broadcast receiver script.
Game Testing
Peer Playtesting Protocol
Swapping seats with a classmate to test game balance!
1. Is it too hard?
If tester dies in under 3 seconds, decrease asteroid speed!
2. Is it too easy?
If tester gets 500 points easily, add a 2nd asteroid!
3. Are there bugs?
Check if scores reset correctly on replay.
Hands-on Challenge
The Speed Boost Level Up!
Mission: Add an if 100> conditional that speeds up falling asteroids from Y change (-6) to Y change (-12)!
Scratch Goal: Make the game get progressively harder as score increases!
Quick Check · Question 1
Why do we put a wait (0.5) seconds block after losing a life in collision detection?
ATo slow down background music
BTo give the player temporary invincibility so they don't lose 3 lives in one instant hit
CTo make the sprite change color
DScratch requires all scripts to pause
Click to reveal answer
Quick Check · Question 2
Which Scratch block allows one sprite to trigger actions across ALL other sprites and backdrops?
Achange size by (10)
Bbroadcast [message v]
Cpoint in direction (90)
Dask [name?] and wait
Click to reveal answer
Milestone Complete
Congratulations! You Built a Game!
- Player Mechanics: Responsive controls & boundary limits.
- Obstacle Mechanics: Procedural random falling objects.
- Game Engine: Score tracking, 3 lives, broadcasts, and Game Over.
Looking Ahead
Next Stop: AI Helpers in Daily Life!
Now that we are master game creators, in Chapter 9 we explore how AI assistants help humans solve real-life daily problems!
Exit Ticket: Share your final high score with the class!