LEARN MIT SCRATCH PROGRAMMING
Learn MIT Scratch: From Zero to Programming Master
Goal: Deeply understand programming fundamentals through Scratch—from basic sequences to advanced concepts like recursion, state machines, and multiplayer networking. These same concepts power every programming language in the world.
Why Scratch Matters
Scratch isn’t just “kid stuff”—it’s a brilliantly designed teaching tool created at MIT’s Media Lab. It strips away the frustration of syntax (missing semicolons, typos, cryptic error messages) so you can focus on thinking like a programmer.
Every block in Scratch maps to real programming concepts:
- “when green flag clicked” → event handlers / main()
- “repeat 10” → for loops
- “forever” → while(true) / infinite loops
- “if-then-else” → conditional statements
- “variable” → variables (same everywhere)
- “broadcast” → message passing / pub-sub
- “clone” → object instantiation / spawning
After completing these projects, you will:
- Understand sequences, loops, conditionals, and variables intuitively
- Know how events drive interactive programs
- Grasp abstraction through custom blocks (functions)
- Work with lists (arrays) and cloning (object creation)
- Build real, playable games and interactive experiences
- Be ready to transition to any text-based programming language
Core Concept Analysis
The Scratch Environment
┌─────────────────────────────────────────────────────────────────┐
│ SCRATCH EDITOR │
├──────────────┬──────────────────────┬──────────────────────────┤
│ │ │ │
│ BLOCK │ CODE AREA │ STAGE │
│ PALETTE │ (Where you drag │ (Where sprites │
│ │ blocks to build │ perform) │
│ - Motion │ scripts) │ │
│ - Looks │ │ ┌──────────────┐ │
│ - Sound │ ┌────────────┐ │ │ │ │
│ - Events │ │when 🏴 │ │ │ 🐱 │ │
│ - Control │ ├────────────┤ │ │ │ │
│ - Sensing │ │move 10 steps│ │ │ │ │
│ - Operators│ └────────────┘ │ └──────────────┘ │
│ - Variables│ │ │
│ - My Blocks│ │ SPRITE LIST │
│ │ │ [Sprite1] [Sprite2] │
└──────────────┴──────────────────────┴──────────────────────────┘
Fundamental Programming Concepts in Scratch
| Scratch Block Category | Programming Concept | Real-World Analogy |
|---|---|---|
| Events (Yellow) | Event handlers, callbacks | “When the doorbell rings, answer the door” |
| Control (Orange) | Loops, conditionals, flow | “Repeat until done; if X, do Y” |
| Motion (Blue) | Coordinates, transformation | Moving pieces on a game board |
| Looks (Purple) | UI/display, state changes | Changing costumes in a play |
| Sensing (Cyan) | Input, collision detection | Eyes and ears of the program |
| Operators (Green) | Math, logic, comparisons | Calculator + true/false logic |
| Variables (Orange) | Data storage, state | Labeled boxes holding values |
| My Blocks (Pink) | Functions, procedures | Reusable recipes |
The Coordinate System
y = 180
↑
│
(-240,180) │ (240,180)
┌────────┼────────┐
│ │ │
│ │ │
x = -240 ───┼────────┼────────┼─── x = 240
│ │(0,0) │
│ │ │
└────────┼────────┘
(-240,-180) │ (240,-180)
│
↓
y = -180
Understanding this grid is essential—every sprite has an (x, y) position.
Project 1: Animated Greeting Card
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Processing, p5.js, Python (Pygame)
- Coolness Level: Level 2: Practical but Forgettable
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 1: Beginner
- Knowledge Area: Animation / Event-Driven Programming
- Software or Tool: MIT Scratch 3.0
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: An animated digital card with moving characters, background changes, music, and text that appears when you click the green flag.
Why it teaches Scratch: This is your “Hello World”—but infinitely more satisfying. You’ll learn how blocks snap together, how sprites work, and how events trigger actions. By the end, you’ll have something you can actually share with someone.
Core challenges you’ll face:
- Placing sprites on the stage → maps to understanding the coordinate system
- Making things happen in sequence → maps to sequential execution
- Adding sound at the right moment → maps to timing and synchronization
- Using the “say” block → maps to output and user feedback
Key Concepts:
- Events (when green flag clicked): Learn to Program with Scratch, Chapter 2 - Majed Marji
- Motion basics (glide, go to): Scratch Tutorials - MIT Scratch Team
- Looks (costumes, effects): CS50 Scratch - Harvard/David Malan
- Sound playback: Scratch Wiki - Sound Blocks
Difficulty: Beginner Time estimate: 2-3 hours Prerequisites: None. Just access to scratch.mit.edu or the Scratch desktop app.
Real world outcome: When you click the green flag:
- A cat sprite glides across the screen saying “Happy Birthday!”
- Stars appear and twinkle (using graphic effects)
- Birthday music plays
- Text animates in and out
- You can share this project with anyone via a Scratch link
Implementation Hints:
Start by asking yourself these questions:
- What story do I want to tell? (Birthday? Holiday? Thank you?)
- What characters (sprites) do I need?
- What should happen first, second, third?
The key insight is that Scratch executes blocks from top to bottom in each script. Think of it like a recipe: step 1, then step 2, then step 3.
Structure your thinking:
WHEN green flag clicked:
1. Set initial positions for all sprites
2. Play background music (use "start sound" not "play sound until done" if you want other things to happen simultaneously)
3. Make character 1 glide to center
4. Make character say greeting
5. Trigger visual effects
Experiment with:
- “glide to x: __ y: __” vs “go to x: __ y: __” (smooth vs instant)
- “say __ for __ seconds” vs “say __” (timed vs permanent)
- Graphic effects like “ghost”, “color”, “brightness”
Learning milestones:
- Card displays and makes sound → You understand basic event-driven programming
- Multiple things animate in sequence → You understand sequential execution
- You customize sprites and sounds → You understand the Scratch asset system
- You share your project → You’ve completed your first program!
Project 2: Interactive Storyteller
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Ren’Py, Twine, Python (text adventure)
- Coolness Level: Level 3: Genuinely Clever
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 1: Beginner
- Knowledge Area: Event Handling / State Management
- Software or Tool: MIT Scratch 3.0
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: A choose-your-own-adventure story where users click on objects or press keys to make decisions, and the story changes based on their choices.
Why it teaches Scratch: Stories require state—keeping track of what has happened. You’ll learn how different sprites can communicate and how user input drives the program flow.
Core challenges you’ll face:
- Responding to user clicks → maps to event handling
- Making sprites communicate → maps to broadcasting messages
- Changing scenes → maps to switching backdrops and costumes
- Remembering choices → maps to variables and state
Key Concepts:
- Broadcasting messages: Learn to Program with Scratch, Chapter 8 - Majed Marji
- Backdrop switching: Scratch Wiki - Stage Blocks
- Costume changes: Scratch Tutorials - Animate a Name - MIT
- Click events (when this sprite clicked): CS50 Scratch - Harvard
Difficulty: Beginner Time estimate: Weekend Prerequisites: Project 1 (Animated Greeting Card)
Real world outcome:
[Scene: A forest with a path splitting in two directions]
NARRATOR: "You come to a fork in the road. Do you go left or right?"
[Two arrow sprites are clickable]
*User clicks LEFT arrow*
[Scene changes to a dark cave]
NARRATOR: "You found a treasure chest!"
*User clicks the chest*
[Chest opens, gold appears]
NARRATOR: "You're rich! THE END"
Implementation Hints:
The secret to interactive stories is the broadcast block. Think of it like shouting a message that any sprite can hear:
Sprite: Left Arrow
WHEN this sprite clicked:
broadcast "go left"
Sprite: Narrator
WHEN I receive "go left":
switch backdrop to "cave"
say "You found a treasure chest!"
Plan your story as a flowchart:
START
│
├─→ [Choice 1: Go Left] → Cave Scene → [Choice A] → Ending 1
│ └→ [Choice B] → Ending 2
│
└─→ [Choice 2: Go Right] → Forest Scene → [Choice C] → Ending 3
Variables come in handy for tracking story state:
has_key= true/false (did the player pick up the key?)coins= 0, 1, 2… (how many coins collected?)
Learning milestones:
- Story responds to clicks → You understand sprite-level events
- Scenes change via broadcasts → You understand message-passing
- Story has multiple endings → You understand branching logic
- Variables track player state → You understand persistent data
Project 3: Dance Party
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Processing, p5.js, JavaScript
- Coolness Level: Level 3: Genuinely Clever
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 1: Beginner
- Knowledge Area: Loops / Animation / Timing
- Software or Tool: MIT Scratch 3.0
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: Multiple characters dancing in sync (and out of sync!) with music, using loops, costume animation, and effects.
Why it teaches Scratch: This project drills loops into your brain. You’ll see the difference between “repeat 10” and “forever”, learn about timing with “wait” blocks, and understand how multiple scripts can run simultaneously.
Core challenges you’ll face:
- Making sprites animate continuously → maps to forever loops
- Synchronizing movement to music → maps to timing and wait blocks
- Creating smooth costume animation → maps to sequential costume switching
- Running multiple animations at once → maps to parallelism/concurrency
Key Concepts:
- Forever loops: Learn to Program with Scratch, Chapter 4 - Majed Marji
- Repeat loops: CS50 Scratch - Harvard
- Wait blocks and timing: Scratch Wiki - Control Blocks
- Costume animation: Scratch Tutorials - Animate a Character - MIT
Difficulty: Beginner Time estimate: 3-4 hours Prerequisites: Project 1 (Animated Greeting Card)
Real world outcome:
- Music plays on a loop
- 3-5 characters dance with different moves
- Background flashes colors to the beat
- Pressing different keys changes dance styles
- Space bar triggers a “freeze” pose
Implementation Hints:
The core of animation in Scratch is costume switching inside loops:
forever
next costume
wait 0.2 seconds
Different wait times = different dance speeds. Experiment!
Key insight: In Scratch, every script runs at the same time (concurrently). This means:
- Sprite 1 can have its own “forever” dance loop
- Sprite 2 can have a different “forever” dance loop
- They both run simultaneously!
Try this experiment to understand parallelism:
Script 1 (Cat): Script 2 (Dog):
when 🏴 clicked when 🏴 clicked
forever forever
say "Hello" say "Woof"
wait 1 second wait 0.5 seconds
Both will run at the same time—you’ll see “Hello” and “Woof” appearing at different rates.
For music sync, the beat is key. If your song is 120 BPM (beats per minute):
- 120 beats ÷ 60 seconds = 2 beats per second
- 1 beat = 0.5 seconds
- Use “wait 0.5 seconds” to sync movements to beats
Learning milestones:
- One sprite dances on loop → You understand forever loops
- Multiple sprites dance simultaneously → You understand concurrency
- Dances sync to music → You understand timing
- Key presses change styles → You understand event-driven control flow
Project 4: Maze Runner
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Python (Pygame), JavaScript (Canvas), Godot
- Coolness Level: Level 3: Genuinely Clever
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 2: Intermediate
- Knowledge Area: Collision Detection / Conditionals
- Software or Tool: MIT Scratch 3.0
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: A game where the player navigates a character through a maze using arrow keys, avoiding walls and reaching a goal.
Why it teaches Scratch: This is your first real game. You’ll learn keyboard input, collision detection (“if touching color”), and the fundamental game loop. The sensing blocks become your best friends.
Core challenges you’ll face:
- Moving with arrow keys → maps to keyboard input handling
- Detecting wall collisions → maps to color/sprite collision sensing
- Preventing movement through walls → maps to conditional logic
- Detecting goal reached → maps to win condition checking
Key Concepts:
- Keyboard events (when key pressed): Learn to Program with Scratch, Chapter 5 - Majed Marji
- Collision detection (touching color?): CS50 Scratch - Harvard
- If-then conditionals: Learn to Program with Scratch, Chapter 6 - Majed Marji
- Game loops: Scratch Game Programming - Udemy Free Course
Difficulty: Intermediate Time estimate: Weekend Prerequisites: Project 1-3 (understanding of loops, events, motion)
Real world outcome:
- Arrow keys move a character smoothly
- Character cannot pass through walls (walls are a specific color)
- Touching the goal (green area or sprite) displays “You Win!”
- Timer shows how long it took to complete
- Multiple levels with increasing difficulty
Implementation Hints:
There are two main approaches to wall collision:
Approach 1: Check before moving
when [right arrow] key pressed
if <not <touching color [black]?>> then
change x by 10
end
Problem: Player can get stuck at edges.
Approach 2: Move then undo (smoother)
forever
if <key [right arrow] pressed?> then
change x by 5
if <touching color [black]?> then
change x by -5
end
end
This creates smooth movement with solid wall collision.
The key insight: sensing blocks return true/false values that you use in conditionals.
For the maze, draw it as a backdrop with clear wall colors (black works great). The floor should be a different color (white or transparent).
Game loop structure:
when 🏴 clicked
go to x: -200 y: -100 ← Start position
reset timer
forever
handle-movement ← Check keys, move, check walls
if <touching [Goal]?> then
say (join "You won in " (timer)) for 2 seconds
stop [all]
end
end
Learning milestones:
- Character moves with arrow keys → You understand keyboard input
- Character stops at walls → You understand collision detection
- Win condition works → You understand game state checking
- Timer tracks completion → You understand built-in Scratch variables
Project 5: Catch the Falling Objects
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Python (Pygame), JavaScript, Godot
- Coolness Level: Level 3: Genuinely Clever
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 2: Intermediate
- Knowledge Area: Variables / Randomness / Cloning
- Software or Tool: MIT Scratch 3.0
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: A game where objects fall from the top of the screen and the player moves a basket/paddle to catch them, earning points for catches and losing lives for misses.
Why it teaches Scratch: This is where variables become essential. You need to track score, lives, and maybe difficulty level. You’ll also learn cloning—Scratch’s way of creating multiple copies of a sprite dynamically.
Core challenges you’ll face:
- Creating falling objects repeatedly → maps to cloning sprites
- Random starting positions → maps to random operators
- Tracking score → maps to variable creation and modification
- Game over conditions → maps to game state management
Key Concepts:
- Variables (make a variable, set, change): Learn to Program with Scratch, Chapter 7 - Majed Marji
- Cloning: Advanced Scratch Programming, Chapter 3 - Abhay Joshi
- Random operator (pick random): CS50 Scratch - Harvard
- Game loops: University of Illinois Scratch Curriculum - Level 2
Difficulty: Intermediate Time estimate: Weekend Prerequisites: Project 4 (Maze Runner) - conditionals and collision
Real world outcome:
┌──────────────────────────────────┐
│ Score: 25 Lives: ♥♥♥ │
├──────────────────────────────────┤
│ │
│ 🍎 🍌 │
│ 🍊 │
│ 🍎 │
│ 🍌 │
│ │
│ ┌─────────┐ │
│ │ BASKET │ │
│ └─────────┘ │
└──────────────────────────────────┘
- Fruits fall from random positions at top
- Move basket with mouse or arrow keys
- Catch fruits = +10 points
- Miss 3 fruits = Game Over
- Speed increases as score goes up
Implementation Hints:
Cloning is powerful. Here’s the pattern:
Main Sprite (Apple) Script:
when 🏴 clicked
hide ← The "template" stays hidden
forever
create clone of [myself]
wait (pick random 1 to 3) seconds
end
when I start as a clone
show
go to x: (pick random -200 to 200) y: 180
repeat until <y position < -170>
change y by -5
end
if <touching [Basket]?> then
change [Score] by 10
play sound [pop]
else
change [Lives] by -1
end
delete this clone
Key insight: The original sprite is a template that spawns clones. Each clone is independent and runs its own copy of the “when I start as a clone” script.
Variable management:
when 🏴 clicked
set [Score] to 0
set [Lives] to 3
forever
if <Lives = 0> then
say "Game Over! Your score: " (Score)
stop [all]
end
end
To increase difficulty over time:
set [fall_speed] to 3
forever
wait 30 seconds
change [fall_speed] by 1
end
Then in the falling code: change y by ((-1) * fall_speed)
Learning milestones:
- Objects fall and can be caught → You understand basic game mechanics
- Score tracks correctly → You understand variables
- Multiple objects fall simultaneously → You understand cloning
- Game ends when lives run out → You understand game state management
Project 6: Pong Clone
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Python (Pygame), JavaScript, C (SDL)
- Coolness Level: Level 4: Hardcore Tech Flex
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 2: Intermediate
- Knowledge Area: Physics Simulation / Two-Player Input
- Software or Tool: MIT Scratch 3.0
- Main Book: “Computer Programming and Game Design with Scratch” - Games for Change
What you’ll build: The classic Pong game—two paddles, one ball, score tracking. The ball bounces off walls and paddles, and players score when the opponent misses.
Why it teaches Scratch: Pong teaches physics-like behavior without a physics engine. You’ll implement bouncing logic manually, handle two simultaneous players, and manage complex game state. This is a rite of passage for game developers.
Core challenges you’ll face:
- Ball bouncing off surfaces → maps to angle reflection and direction
- Two players, different keys → maps to multiple input handling
- Speed increases over time → maps to difficulty scaling
- Score for each player → maps to multiple variables
Key Concepts:
- Direction and motion: Learn to Program with Scratch, Chapter 3 - Majed Marji
- Point in direction / if on edge, bounce: Scratch Wiki - Motion Blocks
- Multiple key detection: CS50 Scratch - Harvard
- Game balance and difficulty: Programming Games with Scratch - CodingFirst
Difficulty: Intermediate Time estimate: 1 week Prerequisites: Projects 4-5 (collision detection, variables)
Real world outcome:
┌────────────────────────────────────────┐
│ Player 1: 3 | Player 2: 5 │
├────────────────────────────────────────┤
│ │
│ ║ ║ │
│ ║ ║ │
│ ║ ●→ ║ │
│ ║ ║ │
│ ║ ║ │
│ │
├────────────────────────────────────────┤
│ Player 1: W/S Player 2: ↑/↓ │
└────────────────────────────────────────┘
Implementation Hints:
Ball bouncing logic:
Scratch has a built-in “if on edge, bounce” block, but for paddles you need custom logic:
when 🏴 clicked
point in direction (pick random 45 to 135) ← or 225 to 315 for left
forever
move 10 steps
if on edge, bounce
if <touching [Paddle1]?> then
point in direction ((180) - (direction)) ← Reflect horizontally
change x by 10 ← Move away to prevent re-triggering
end
if <touching [Paddle2]?> then
point in direction ((180) - (direction))
change x by -10
end
end
The formula 180 - direction reflects horizontally. For vertical reflection (top/bottom), use (direction) * -1.
Two-player controls:
Don’t use “when key pressed” events—they can conflict. Instead, check keys in a forever loop:
Paddle 1 (forever loop):
if <key [w] pressed?> then
change y by 10
end
if <key [s] pressed?> then
change y by -10
end
Paddle 2 (forever loop):
if <key [up arrow] pressed?> then
change y by 10
end
if <key [down arrow] pressed?> then
change y by -10
end
Scoring:
Ball script:
if <x position > 230> then ← Ball passed right edge
change [Player1Score] by 1
go to x: 0 y: 0
point in direction (pick random 135 to 225)
end
Learning milestones:
- Ball bounces off edges → You understand basic physics
- Ball bounces off paddles → You understand collision + direction manipulation
- Two players can play → You understand multi-input handling
- Score works correctly → You understand game state across sprites
Project 7: Drawing Tool (Etch-a-Sketch)
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: JavaScript (Canvas), Python (Turtle), Processing
- Coolness Level: Level 3: Genuinely Clever
- Business Potential: 2. The “Micro-SaaS / Pro Tool”
- Difficulty: Level 2: Intermediate
- Knowledge Area: Pen Extension / User Input / State
- Software or Tool: MIT Scratch 3.0 (Pen Extension)
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: A drawing application where users can draw with their mouse (or keys), change colors, adjust pen size, and clear the canvas.
Why it teaches Scratch: The Pen extension opens up a whole new world. You’ll understand that sprites can leave permanent marks on the stage, creating possibilities beyond just moving sprites around.
Core challenges you’ll face:
- Drawing with pen down/up → maps to pen state management
- Following mouse position → maps to continuous input tracking
- Color and size controls → maps to variables affecting behavior
- Clear canvas function → maps to reset/initialization
Key Concepts:
- Pen extension basics: Scratch Wiki - Pen Blocks
- Mouse following (go to mouse-pointer): Learn to Program with Scratch, Chapter 10 - Majed Marji
- Pen color and size: Scratch Tutorials - Make Music - MIT
- Forever loops for continuous tracking: CS50 Scratch - Harvard
Difficulty: Intermediate Time estimate: Weekend Prerequisites: Understanding of forever loops and variables
Real world outcome:
- Move mouse to draw
- Press C to change color (cycles through rainbow)
- Press +/- to change pen size
- Press Space to clear canvas
- Draw actual pictures and shapes!
Implementation Hints:
First, add the Pen extension (click “Add Extension” → “Pen”).
Basic drawing:
when 🏴 clicked
erase all
pen up
forever
go to (mouse-pointer)
if <mouse down?> then
pen down
else
pen up
end
end
Color cycling with a variable:
when [c] key pressed
change [pen_hue] by 25
set pen color to (pen_hue) ← Use "set pen (color) to" block
Scratch pen color is on a 0-100 scale (hue). 0=red, 25=yellow, 50=green, 75=blue, 100=back to red.
Pen size control:
when [+] key pressed
change pen size by 5
when [-] key pressed
change pen size by -5
Advanced: Draw shapes
when [s] key pressed ← Draw a square
pen down
repeat 4
move 100 steps
turn right 90 degrees
end
pen up
This leads naturally to understanding how Logo/Turtle graphics work!
Learning milestones:
- Mouse drawing works → You understand pen and mouse tracking
- Color changes → You understand variables affecting pen properties
- Size adjusts → You understand input modifying behavior
- You draw actual art → You’ve created a tool, not just a game!
Project 8: Music Maker / Drum Machine
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: JavaScript (Web Audio API), Python (Pygame.mixer), Sonic Pi
- Coolness Level: Level 4: Hardcore Tech Flex
- Business Potential: 2. The “Micro-SaaS / Pro Tool”
- Difficulty: Level 2: Intermediate
- Knowledge Area: Sound / Lists / Sequencing
- Software or Tool: MIT Scratch 3.0 (Music Extension)
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: A drum machine or music sequencer where you can create patterns, record beats, and play them back in a loop.
Why it teaches Scratch: Music requires lists (arrays)—you’re storing sequences of notes/beats and playing them back. This is one of the most satisfying introductions to data structures.
Core challenges you’ll face:
- Playing notes and drums → maps to Music extension usage
- Recording a pattern → maps to adding to lists
- Playing back patterns → maps to iterating through lists
- Looping patterns → maps to nested loops
Key Concepts:
- Lists (add, delete, item # of): Learn to Program with Scratch, Chapter 9 - Majed Marji
- Music extension: Scratch Wiki - Music Extension Blocks
- Loops with lists (repeat length of list): Advanced Scratch Programming, Chapter 4 - Abhay Joshi
- Timing in music: Scratch Tutorials - Make Music - MIT
Difficulty: Intermediate Time estimate: 1 week Prerequisites: Variables, loops, understanding of events
Real world outcome:
╔══════════════════════════════════════╗
║ SCRATCH DRUM MACHINE ║
╠══════════════════════════════════════╣
║ ║
║ [KICK] [SNARE] [HAT] [CLAP] ║
║ 1 2 3 4 ║
║ ║
║ Pattern: ● ○ ● ○ | ○ ● ○ ● | ... ║
║ ║
║ [RECORD] [PLAY] [CLEAR] ║
╚══════════════════════════════════════╝
Press 1,2,3,4 to trigger sounds live
Record mode captures your pattern
Play loops the pattern forever
Implementation Hints:
Add the Music extension first.
Simple drum triggers:
when [1] key pressed
play drum (1 Snare Drum) for 0.25 beats
when [2] key pressed
play drum (2 Bass Drum) for 0.25 beats
Recording with a list: Create a list called “pattern”
when [r] key pressed ← Start recording
set [recording] to 1
delete all of [pattern]
broadcast [start timer]
when [1] key pressed
if <recording = 1> then
add "kick" to [pattern]
end
play drum (1 Bass Drum) for 0.25 beats
Playback from list:
when [p] key pressed
forever
set [index] to 1
repeat (length of [pattern])
if <item (index) of [pattern] = "kick"> then
play drum (1 Bass Drum) for 0.25 beats
end
if <item (index) of [pattern] = "snare"> then
play drum (2 Snare Drum) for 0.25 beats
end
change [index] by 1
end
end
Advanced: Step sequencer with grid Use a list like: “kick”, “rest”, “snare”, “rest”, “kick”, “hat”, “snare”, “rest”
Learning milestones:
- Keys trigger sounds → You understand sound playback
- Pattern records correctly → You understand lists (add)
- Pattern plays back → You understand list iteration
- Loop plays continuously → You’ve built a sequencer!
Project 9: Platformer Game
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Godot, Unity (C#), Python (Pygame)
- Coolness Level: Level 4: Hardcore Tech Flex
- Business Potential: 2. The “Micro-SaaS / Pro Tool”
- Difficulty: Level 3: Advanced
- Knowledge Area: Physics Simulation / Level Design
- Software or Tool: MIT Scratch 3.0
- Main Book: “Advanced Scratch Programming” by Abhay B. Joshi
What you’ll build: A Mario-style platformer with gravity, jumping, platforms, collectibles, and enemies.
Why it teaches Scratch: Platformers require simulated physics—gravity pulling down, jump velocity, landing detection. You’ll implement these from first principles, understanding why game engines exist.
Core challenges you’ll face:
- Implementing gravity → maps to continuous velocity application
- Jumping with proper arc → maps to initial velocity + gravity
- Landing on platforms → maps to collision detection from below
- Side collisions with walls → maps to directional collision handling
Key Concepts:
- Velocity variables (x_velocity, y_velocity): Advanced Scratch Programming, Chapter 5 - Abhay Joshi
- Gravity simulation: Instructables - Advanced Game Development Using Scratch 3.0
- Platform collision from multiple directions: Griffpatch tutorials - YouTube
- Level design basics: Game Dev Academy - Scratch Tutorials
Resources for platformer physics:
- “Griffpatch Scratch Platformer Tutorial” on YouTube - The definitive Scratch platformer guide
Difficulty: Advanced Time estimate: 2 weeks Prerequisites: Projects 4-6 (collision, variables, game loops)
Real world outcome:
- Character runs left/right with arrow keys
- Character jumps with space (proper arc, not teleport)
- Character lands on platforms, doesn’t fall through
- Collectible coins increase score
- Enemies kill player on touch
- Multiple levels with increasing difficulty
Implementation Hints:
The core insight: Use velocity variables, not direct position changes.
Variables needed:
- x_velocity (horizontal speed)
- y_velocity (vertical speed, includes gravity)
- on_ground (are we standing on something?)
Gravity loop:
forever
change [y_velocity] by -1 ← Gravity pulls down
change y by (y_velocity)
← Check if we hit the ground
if <touching color [brown]?> then
repeat until <not <touching color [brown]?>>
change y by 1 ← Push back up
end
set [y_velocity] to 0
set [on_ground] to 1
else
set [on_ground] to 0
end
end
Jumping:
when [space] key pressed
if <on_ground = 1> then
set [y_velocity] to 15 ← Initial jump velocity
end
The beauty: gravity (-1 each frame) naturally creates the arc:
- Frame 1: y_velocity = 15 (going up fast)
- Frame 2: y_velocity = 14
- …
- Frame 15: y_velocity = 0 (peak of jump)
- Frame 16: y_velocity = -1 (starting to fall)
- etc.
Side collision (walls):
change x by (x_velocity)
if <touching color [brown]?> then
change x by ((x_velocity) * -1) ← Undo the move
set [x_velocity] to 0
end
Learning milestones:
- Character falls with gravity → You understand velocity-based physics
- Jumping feels right → You understand initial velocity + gravity
- Landing works perfectly → You understand ground detection
- Full level is playable → You’ve built a real platformer!
Project 10: Snake Game
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Python, JavaScript, C
- Coolness Level: Level 4: Hardcore Tech Flex
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 3: Advanced
- Knowledge Area: Lists / Cloning / Game Logic
- Software or Tool: MIT Scratch 3.0
- Main Book: “Advanced Scratch Programming” by Abhay B. Joshi
What you’ll build: The classic Snake game—a growing snake that eats food, grows longer, and dies if it hits itself or walls.
Why it teaches Scratch: Snake requires tracking a list of positions for the snake body. Each segment follows the one ahead. This is a brilliant introduction to how real game engines handle entity positions.
Core challenges you’ll face:
- Moving the snake continuously → maps to game loop with direction
- Growing the snake body → maps to list manipulation (add/remove)
- Tail following head → maps to queue data structure (FIFO)
- Self-collision detection → maps to iterating through positions
Key Concepts:
- Lists as position history: Learn to Program with Scratch, Chapter 9 - Majed Marji
- Queue-like behavior (add front, remove back): Introduction to Computation and Programming Using Python, Chapter 5 - John Guttag
- Direction-based movement: Advanced Scratch Programming, Chapter 6 - Abhay Joshi
- Self-collision checking: University of Illinois Scratch Curriculum - Level 3
Difficulty: Advanced Time estimate: 1-2 weeks Prerequisites: Lists (Project 8), collision detection (Project 4-6)
Real world outcome:
╔═══════════════════════════════════╗
║ SNAKE Score: 45 ║
╠═══════════════════════════════════╣
║ ║
║ ████████→ ║
║ ▼ ║
║ █ ║
║ ● ← Apple ║
║ ║
║ ║
╚═══════════════════════════════════╝
Arrow keys to change direction
Eat apples to grow
Don't hit yourself or walls!
Implementation Hints:
The key data structure: Two lists that store X and Y positions of every snake segment.
Lists:
- snake_x: [0, -20, -40, -60] ← X positions
- snake_y: [0, 0, 0, 0] ← Y positions
(Head is at index 1, tail is at the end)
Movement logic (called every tick):
← Calculate new head position based on direction
set [new_x] to ((item 1 of [snake_x]) + (x_move))
set [new_y] to ((item 1 of [snake_y]) + (y_move))
← Add new head position to front of lists
insert (new_x) at 1 of [snake_x]
insert (new_y) at 1 of [snake_y]
← Remove tail (unless we just ate food)
if <not <ate_food = 1>> then
delete (last) of [snake_x]
delete (last) of [snake_y]
end
Drawing the snake (using clones or pen):
← Using Pen:
erase all
set [i] to 1
repeat (length of [snake_x])
go to x: (item (i) of [snake_x]) y: (item (i) of [snake_y])
stamp ← Or use pen
change [i] by 1
end
Self-collision check:
set [i] to 2 ← Start at segment 2 (not the head itself)
repeat ((length of [snake_x]) - 1)
if <<(item (i) of [snake_x]) = (new_x)> and <(item (i) of [snake_y]) = (new_y)>> then
broadcast [game over]
end
change [i] by 1
end
Direction handling (prevent reversing):
when [right arrow] key pressed
if <not <direction = "left">> then
set [direction] to "right"
set [x_move] to 20
set [y_move] to 0
end
Learning milestones:
- Snake moves continuously in one direction → You understand game loops
- Snake changes direction → You understand direction state
- Snake grows when eating → You understand list manipulation
- Snake dies on self-collision → You understand list iteration for checking
Project 11: Flappy Bird Clone
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: JavaScript, Python (Pygame), Swift
- Coolness Level: Level 4: Hardcore Tech Flex
- Business Potential: 2. The “Micro-SaaS / Pro Tool”
- Difficulty: Level 3: Advanced
- Knowledge Area: Cloning / Scrolling / Timing
- Software or Tool: MIT Scratch 3.0
- Main Book: “Advanced Scratch Programming” by Abhay B. Joshi
What you’ll build: A Flappy Bird clone where a bird (or any sprite) flaps through gaps in scrolling pipes.
Why it teaches Scratch: This combines cloning (pipes), physics (gravity + flap), and the illusion of scrolling (pipes move left, bird stays centered horizontally). It’s a masterclass in game feel.
Core challenges you’ll face:
- Bird physics (flap + gravity) → maps to velocity-based movement
- Spawning pipes continuously → maps to cloning with timers
- Random gap positions → maps to randomness in level generation
- Smooth scrolling illusion → maps to object movement, not camera movement
Key Concepts:
- Cloning for obstacles: Advanced Scratch Programming, Chapter 3 - Abhay Joshi
- Velocity-based physics: Instructables - Advanced Game Development
- Procedural generation (random gaps): Griffpatch Flappy Bird tutorial - YouTube
- Scrolling mechanics: Create & Learn - Scratch Projects for Kids
Resources for Flappy Bird mechanics:
- “Griffpatch Flappy Bird Tutorial” on YouTube - Excellent step-by-step guide
Difficulty: Advanced Time estimate: 1-2 weeks Prerequisites: Platformer project (gravity), cloning (Catch Game)
Real world outcome:
- Bird hovers on screen, falls with gravity
- Tapping space makes bird “flap” (jump upward)
- Pipes scroll from right to left with random gap positions
- Passing through pipes increases score
- Hitting pipes or ground = game over
- Difficulty increases (pipes speed up or gaps get smaller)
Implementation Hints:
Bird physics:
set [y_velocity] to 0
forever
change [y_velocity] by -0.5 ← Gravity (gentler than platformer)
change y by (y_velocity)
← Angle the bird based on velocity
point in direction ((y_velocity) * 3)
if <touching [ground]?> or <touching [Pipe]?> then
broadcast [game over]
end
end
when [space] key pressed
set [y_velocity] to 7 ← Flap strength
Pipe spawning (template sprite, hidden):
when 🏴 clicked
hide
forever
create clone of [myself]
wait (pick random 1.5 to 2.5) seconds
end
when I start as a clone
show
set [gap_y] to (pick random -100 to 100) ← Random gap position
go to x: 250 y: (gap_y)
repeat until <x position < -250>
change x by -3 ← Scroll speed
← Score detection
if <<x position < 0> and <x position > -5>> then
change [score] by 1
end
end
delete this clone
Pipe sprite design: The pipe sprite should have a gap in the middle. The gap_y variable shifts where that gap is positioned.
Alternatively, use two sprites: TopPipe and BottomPipe, and position them based on gap_y:
- TopPipe: y = gap_y + 150
- BottomPipe: y = gap_y - 150
Learning milestones:
- Bird flaps and falls correctly → You understand physics tuning
- Pipes scroll across screen → You understand the scrolling illusion
- Random gaps work → You understand procedural generation
- Score increases on pass → You understand precise collision/position detection
Project 12: Quiz Game
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: JavaScript, Python, HTML/CSS
- Coolness Level: Level 2: Practical but Forgettable
- Business Potential: 2. The “Micro-SaaS / Pro Tool”
- Difficulty: Level 2: Intermediate
- Knowledge Area: Lists / User Input / String Comparison
- Software or Tool: MIT Scratch 3.0
- Main Book: “Learn to Program with Scratch” by Majed Marji
What you’ll build: A multiple-choice or text-input quiz game that tracks score, shows questions from a list, and gives feedback on answers.
Why it teaches Scratch: Quizzes require parallel lists (questions in one list, answers in another). You’ll also learn to use the “ask and wait” block for user input.
Core challenges you’ll face:
- Storing questions and answers → maps to parallel lists
- Getting user input → maps to ask block and answer variable
- Checking correctness → maps to string comparison
- Randomizing questions → maps to shuffling or random selection
Key Concepts:
- Parallel lists: Learn to Program with Scratch, Chapter 9 - Majed Marji
- Ask and answer blocks: Scratch Wiki - Sensing Blocks
- String operations and comparison: CS50 Scratch - Harvard
- Pick random for randomization: Advanced Scratch Programming, Chapter 4 - Abhay Joshi
Difficulty: Intermediate Time estimate: Weekend Prerequisites: Lists (Project 8)
Real world outcome:
╔══════════════════════════════════════════╗
║ SCRATCH QUIZ Score: 3/5 ║
╠══════════════════════════════════════════╣
║ ║
║ Question 5 of 10: ║
║ ║
║ "What is the capital of France?" ║
║ ║
║ Your answer: [_____________] ║
║ ║
║ ✓ Previous: Correct! (+10 points) ║
║ ║
╚══════════════════════════════════════════╝
Implementation Hints:
Data setup (parallel lists):
List: questions
1. "What is 5 + 3?"
2. "Capital of France?"
3. "How many legs does a spider have?"
List: answers
1. "8"
2. "Paris"
3. "8"
(Index 1 in questions corresponds to index 1 in answers)
Main quiz loop:
when 🏴 clicked
set [score] to 0
set [question_num] to 1
repeat (length of [questions])
ask (item (question_num) of [questions]) and wait
if <(answer) = (item (question_num) of [answers])> then
say "Correct!" for 1 seconds
change [score] by 1
else
say (join "Wrong! Answer was: " (item (question_num) of [answers])) for 2 seconds
end
change [question_num] by 1
end
say (join "Final score: " (join (score) (join "/" (length of [questions]))))
Case-insensitive comparison (advanced): The above is case-sensitive (“Paris” ≠ “paris”). For case-insensitive:
← Use Scratch operators to lowercase both sides
set [user_answer] to (join "" (answer)) ← Normalize
← Unfortunately, Scratch doesn't have built-in lowercase.
← Options: Accept multiple variations in your answer list, or prompt with expected format.
Random question order:
set [asked] to (list of empty)
repeat (length of [questions])
repeat until <not <(asked) contains (question_num)?>>
set [question_num] to (pick random 1 to (length of [questions]))
end
add (question_num) to [asked]
← Ask question at question_num...
end
Learning milestones:
- Questions display from list → You understand list indexing
- Answers are checked → You understand string comparison
- Score updates correctly → You understand variables with lists
- Questions randomize → You understand random selection
Project 13: Tower Defense Game
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Godot, Unity, JavaScript
- Coolness Level: Level 5: Pure Magic (Super Cool)
- Business Potential: 3. The “Service & Support” Model
- Difficulty: Level 3: Advanced
- Knowledge Area: Cloning / AI Pathfinding / Complex State
- Software or Tool: MIT Scratch 3.0
- Main Book: “Advanced Scratch Programming” by Abhay B. Joshi
What you’ll build: A tower defense game where enemies follow a path, and you place towers that automatically shoot at them.
Why it teaches Scratch: Tower defense combines everything: cloning (enemies and projectiles), lists (tracking multiple enemies, path points), targeting logic (towers finding nearest enemy), and complex state management.
Core challenges you’ll face:
- Enemies following a path → maps to lists of waypoints + movement
- Towers targeting enemies → maps to finding nearest sprite/position
- Projectiles hitting enemies → maps to clone-to-clone interaction
- Economy (gold for towers) → maps to resource management variables
Key Concepts:
- Path following with lists: Advanced Scratch Programming, Chapter 6 - Abhay Joshi
- Distance formula (Pythagorean): Scratch Wiki - Operators
- Clone communication patterns: University of Illinois Scratch Curriculum - Level 3
- Game economy design: Computer Programming and Game Design with Scratch - Games for Change
Difficulty: Advanced Time estimate: 2-3 weeks Prerequisites: All previous projects (especially cloning, lists, collision)
Real world outcome:
╔════════════════════════════════════════════════╗
║ SCRATCH TOWER DEFENSE Gold: 150 Wave: 3║
╠════════════════════════════════════════════════╣
║ ║
║ START →─●─●─●─┐ ║
║ │ ║
║ [T] ↓ [T] = Tower ║
║ │ ● = Enemy ║
║ ┌─────────┘ ║
║ │ ║
║ └──●────●──────→ END (Lives: 10) ║
║ [T] ║
║ ║
╚════════════════════════════════════════════════╝
Implementation Hints:
Path system (list of waypoints):
List: path_x = [−200, −200, 0, 0, 200, 200]
List: path_y = [150, 0, 0, −100, −100, 150]
Variable: waypoint_index (per enemy clone)
Enemy movement:
when I start as a clone
show
go to x: (item 1 of [path_x]) y: (item 1 of [path_y])
set [my_waypoint] to 2
set [my_health] to 100
forever
← Move toward current waypoint
point towards x: (item (my_waypoint) of [path_x]) y: (item (my_waypoint) of [path_y])
move 2 steps
← Check if reached waypoint
if <distance to x: (item (my_waypoint) of [path_x]) y: (item (my_waypoint) of [path_y])) < 10> then
change [my_waypoint] by 1
if <my_waypoint > (length of [path_x])> then
← Reached the end!
change [lives] by -1
delete this clone
end
end
← Check if dead
if <my_health < 1> then
change [gold] by 10
delete this clone
end
end
Tower targeting:
Tower sprite (forever loop):
set [closest_dist] to 999
set [target_x] to 0
set [target_y] to 0
← For each enemy, check if in range and closer than current target
← This is tricky in Scratch - one approach is to have enemies broadcast their position
← Simpler approach: point towards nearest enemy
point towards [Enemy] ← Points to random enemy if multiple
if <distance to [Enemy] < 100> then ← Tower range
create clone of [Bullet]
end
wait 1 second ← Fire rate
Bullet sprite:
when I start as a clone
point in direction ([direction] of [Tower])
repeat until <touching [Enemy]?> or <touching [edge]?>
move 10 steps
end
if <touching [Enemy]?> then
broadcast [hit enemy] ← Enemy scripts listen for this
end
delete this clone
Learning milestones:
- Enemies follow the path → You understand waypoint-based movement
- Towers shoot at enemies → You understand targeting logic
- Enemies die and give gold → You understand clone state management
- Full game is playable → You’ve built a complex multi-system game!
Project 14: Procedural Art Generator
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Processing, p5.js, Python (Turtle)
- Coolness Level: Level 5: Pure Magic (Super Cool)
- Business Potential: 2. The “Micro-SaaS / Pro Tool”
- Difficulty: Level 3: Advanced
- Knowledge Area: Pen / Recursion-like Patterns / Math
- Software or Tool: MIT Scratch 3.0 (Pen Extension)
- Main Book: “Computer Graphics from Scratch” by Gabriel Gambetta
What you’ll build: A program that generates beautiful mathematical art—spirals, fractals, patterns—using the pen extension and math.
Why it teaches Scratch: This pushes Scratch to its limits. You’ll learn to use My Blocks with inputs (like functions with parameters), creating patterns that call themselves (recursion-like behavior). It’s deeply mathematical but visually stunning.
Core challenges you’ll face:
- Drawing with mathematical formulas → maps to using operators creatively
- Creating repeating patterns → maps to loops with changing parameters
- Self-similar patterns (fractals) → maps to recursion via custom blocks
- Color gradients → maps to mathematical color manipulation
Key Concepts:
- My Blocks with inputs: Learn to Program with Scratch, Chapter 11 - Majed Marji
- Trigonometry for patterns (sin/cos): Math for Programmers, Chapter 2 - Paul Orland
- Recursion concepts: University of Illinois Scratch Curriculum - Level 3
- Pen color mathematics: Scratch Wiki - Pen Blocks
Difficulty: Advanced Time estimate: 1-2 weeks Prerequisites: Drawing Tool project, understanding of loops
Real world outcome:
- Spirograph patterns
- Tree fractals (branches splitting into smaller branches)
- Mandala-like designs
- Color-shifting gradient art
- Press space to generate a new random artwork each time
Implementation Hints:
Simple spiral:
when 🏴 clicked
erase all
pen down
set pen size to 1
repeat 360
move (i / 10) steps ← Distance increases
turn right 5 degrees
change pen color by 1 ← Shift through spectrum
change [i] by 1
end
Spirograph:
set [angle] to 0
set [radius1] to 100
set [radius2] to 40
repeat 2000
set [x] to ((radius1) * ([cos] of (angle))) + ((radius2) * ([cos] of ((angle) * 3))))
set [y] to ((radius1) * ([sin] of (angle))) + ((radius2) * ([sin] of ((angle) * 3))))
go to x: (x) y: (y)
if <angle > 0> then
pen down
else
pen up
end
change [angle] by 1
end
Tree fractal (using My Blocks for recursion):
define draw-branch (length) (angle)
if <length > 5> then
pen down
move (length) steps
turn right (angle)
draw-branch ((length) * 0.7) (angle) ← Recurse!
turn left ((angle) * 2)
draw-branch ((length) * 0.7) (angle) ← Recurse!
turn right (angle)
pen up
move ((length) * -1) steps ← Go back
end
when 🏴 clicked
go to x: 0 y: -150
point in direction 0 ← Face up
draw-branch 80 25
Note: Scratch doesn’t have true recursion (the call stack is limited), but for visual depth of 5-8 levels, it works beautifully.
Learning milestones:
- Basic patterns appear → You understand pen + loops + math
- Spirograph works → You understand trigonometry in programming
- Tree fractal draws → You understand self-similar patterns
- Random generation works → You’ve created generative art!
Project 15: RPG Combat System
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Python, JavaScript, Godot
- Coolness Level: Level 4: Hardcore Tech Flex
- Business Potential: 2. The “Micro-SaaS / Pro Tool”
- Difficulty: Level 3: Advanced
- Knowledge Area: State Machines / Turn-Based Logic
- Software or Tool: MIT Scratch 3.0
- Main Book: “Advanced Scratch Programming” by Abhay B. Joshi
What you’ll build: A turn-based combat system like Final Fantasy or Pokémon—with HP, attacks, items, and a proper battle flow.
Why it teaches Scratch: Turn-based systems are state machines—you’re in “player_turn” state, then “enemy_turn” state, then “check_win_condition” state. Understanding state machines is crucial for any complex program.
Core challenges you’ll face:
- Managing battle state (whose turn?) → maps to state machine pattern
- Different attack types with varying effects → maps to data-driven design
- HP bars and UI updates → maps to visual state representation
- AI for enemy behavior → maps to simple decision making
Key Concepts:
- State machines: Game Programming Patterns (free online) - Robert Nystrom
- Turn-based logic: Advanced Scratch Programming, Chapter 7 - Abhay Joshi
- UI design in Scratch: Scratch Wiki - Creating Interfaces
- Random AI decisions: CS50 Scratch - Harvard
Difficulty: Advanced Time estimate: 2 weeks Prerequisites: Variables, broadcasts, conditionals mastery
Real world outcome:
╔══════════════════════════════════════════════════╗
║ BATTLE! ║
╠══════════════════════════════════════════════════╣
║ ║
║ [HERO] [SLIME] ║
║ HP: ████████░░ 80/100 HP: ███░░░░ 30/100 ║
║ ║
╠══════════════════════════════════════════════════╣
║ YOUR TURN - Choose an action: ║
║ ║
║ [1. ATTACK] [2. MAGIC] [3. ITEM] [4. RUN] ║
║ ║
║ > Fireball costs 20 MP, deals 40 damage ║
╚══════════════════════════════════════════════════╝
Implementation Hints:
State machine with broadcasts:
States: "player_turn", "player_action", "enemy_turn", "enemy_action", "check_end", "battle_over"
when I receive [player_turn]
say "What will you do?" for 1 seconds
broadcast [show_menu]
when I receive [show_menu]
← Enable clicking on Attack, Magic, Item buttons
when [Attack Button] clicked
if <battle_state = "player_turn"> then
broadcast [player_attack]
end
when I receive [player_attack]
set [battle_state] to "player_action"
← Play attack animation
← Calculate damage
set [damage] to ((player_attack) + (pick random -5 to 5))
change [enemy_hp] by ((damage) * -1)
say (join "Hit for " (join (damage) " damage!"))
wait 1 second
broadcast [check_end]
when I receive [check_end]
if <enemy_hp < 1> then
broadcast [victory]
else
broadcast [enemy_turn]
end
HP bar (visual):
Sprite: HP_Bar
when 🏴 clicked
forever
set size to ((player_hp / player_max_hp) * 100) %
← Or use "switch costume" if size stretching looks bad
end
Enemy AI:
when I receive [enemy_turn]
wait 1 second
set [enemy_choice] to (pick random 1 to 100)
if <enemy_choice < 70> then
broadcast [enemy_attack]
else
if <enemy_hp < 30> then
broadcast [enemy_heal]
else
broadcast [enemy_attack]
end
end
Learning milestones:
- Turns alternate correctly → You understand state machines
- Attacks deal damage → You understand data + actions
- Battle ends properly → You understand win/lose conditions
- Enemy makes decisions → You understand basic AI
Project 16: Multiplayer Game (Cloud Variables)
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: JavaScript (Socket.io), Python (sockets)
- Coolness Level: Level 5: Pure Magic (Super Cool)
- Business Potential: 3. The “Service & Support” Model
- Difficulty: Level 4: Expert
- Knowledge Area: Networking / Cloud Data / Synchronization
- Software or Tool: MIT Scratch 3.0 (Cloud Variables)
- Main Book: “TCP/IP Illustrated” by W. Richard Stevens (conceptual)
What you’ll build: A real multiplayer game where two or more people can play together over the internet using Scratch’s cloud variables.
Why it teaches Scratch: Cloud variables introduce networking concepts—data that syncs between computers. You’ll learn about the challenges of multiplayer: latency, synchronization, who is the “source of truth.”
Core challenges you’ll face:
- Understanding cloud variable limits → maps to networking constraints
- Syncing player positions → maps to data serialization
- Handling multiple players → maps to player ID systems
- Dealing with latency → maps to network timing issues
Key Concepts:
- Cloud variables: Scratch Wiki - Cloud Data
- Data encoding (fitting data in limited space): Advanced Scratch Programming, Chapter 8 - Abhay Joshi
- Multiplayer game architecture: Building Multiplayer Games concepts
- Turn-based vs real-time sync: Game Dev patterns
Difficulty: Expert Time estimate: 2-3 weeks Prerequisites: All previous projects; must be a Scratcher (Scratch account requirement)
Real world outcome:
- Player 1 in USA moves their character
- Player 2 in Japan sees Player 1’s movement (with slight delay)
- Both can interact in the same game world
- A real networked game!
Implementation Hints:
Cloud variable basics:
- You can only create cloud variables if you’re a “Scratcher” (have Scratch experience)
- Cloud variables can ONLY store numbers (not strings!)
- Limited to 10 cloud variables per project
- Updates are rate-limited (~10 per second)
Encoding position data: Since cloud variables only hold numbers, encode x and y together:
set [☁ player1_data] to ((x position + 240) * 1000) + (y position + 180))
← x=-100, y=50 becomes: 140 * 1000 + 230 = 140230
To decode:
set [p1_x] to ((floor ((☁ player1_data) / 1000)) - 240)
set [p1_y] to (((☁ player1_data) mod 1000) - 180)
Player identification:
when 🏴 clicked
if <☁ player1_active = 0> then
set [☁ player1_active] to 1
set [my_player_id] to 1
else
set [my_player_id] to 2
set [☁ player2_active] to 1
end
Sync loop (local player):
forever
if <my_player_id = 1> then
set [☁ player1_data] to (encode my position)
end
wait 0.1 seconds ← Don't spam updates
end
Sync loop (remote player):
forever
if <my_player_id = 1> then
← I control player 1, so render player 2's position from cloud
set [p2_x] to (decode ☁ player2_data x)
set [p2_y] to (decode ☁ player2_data y)
Player2 sprite: glide 0.1 secs to x: (p2_x) y: (p2_y)
end
wait 0.05 seconds
end
Game ideas that work well:
- Turn-based games (chess, tic-tac-toe) - latency doesn’t matter
- Drawing games (one draws, other guesses)
- Racing games (each player against their own obstacles, compare times)
- Tag/chase games (simpler than precise fighting games)
Learning milestones:
- Two instances connect → You understand cloud variable sharing
- Player positions sync → You understand data encoding
- Game is playable → You understand sync timing
- You play with a friend → You’ve built a networked game!
Project 17: Build a Physics Engine
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: JavaScript, Python, C++
- Coolness Level: Level 5: Pure Magic (Super Cool)
- Business Potential: 3. The “Service & Support” Model
- Difficulty: Level 4: Expert
- Knowledge Area: Physics Simulation / Mathematics
- Software or Tool: MIT Scratch 3.0
- Main Book: “Game Physics Engine Development” by Ian Millington (conceptual)
What you’ll build: A mini physics engine that simulates gravity, bouncing, friction, and collision between multiple objects.
Why it teaches Scratch: Physics engines are the ultimate test of understanding motion and forces. You’ll implement the math that makes games feel “real” from first principles.
Core challenges you’ll face:
- Continuous physics simulation → maps to velocity and acceleration
- Bouncing with energy loss → maps to coefficient of restitution
- Friction slowing objects → maps to force application
- Multiple object collision → maps to n-body interaction
Key Concepts:
- Velocity and acceleration: Computer Graphics from Scratch, Chapter 2 - Gabriel Gambetta
- Collision response: Math for Programmers, Chapter 8 - Paul Orland
- Energy conservation (bouncing): Physics for Game Developers - Bourg & Bywalec
- Integration methods (Euler): Basic calculus concepts
Difficulty: Expert Time estimate: 2-3 weeks Prerequisites: Platformer project, strong math intuition
Real world outcome:
- Drop balls that bounce realistically
- Balls slow down due to friction
- Balls collide with each other
- Adjust gravity, bounciness, friction with sliders
Implementation Hints:
Basic physics for one ball:
Variables: x_vel, y_vel, gravity, bounciness, friction
forever
← Apply gravity
change [y_vel] by (gravity) ← gravity = -0.5
← Move
change x by (x_vel)
change y by (y_vel)
← Floor collision
if <y position < -170> then
set y to -170
set [y_vel] to ((y_vel) * (bounciness) * -1) ← Bounce! bounciness = 0.8
set [x_vel] to ((x_vel) * (friction)) ← Slow horizontal: friction = 0.99
end
← Wall collision
if <(x position > 230) or (x position < -230)> then
set [x_vel] to ((x_vel) * -0.9)
end
end
Multiple balls (using clones with private variables): Scratch clones share variables by default, which is problematic. Solutions:
- Use lists where index = clone ID
- Use “for this sprite only” variables (local to each clone)
when I start as a clone
set [my_x_vel] to (pick random -10 to 10) ← Private variable
set [my_y_vel] to 0
forever
← Physics using my_x_vel, my_y_vel
end
Ball-to-ball collision (advanced):
← Check distance between this ball and all others
← If distance < sum of radii, they're colliding
← Collision response: exchange velocity components along collision axis
distance = sqrt((x1-x2)² + (y1-y2)²)
if distance < (radius1 + radius2):
← Separate balls so they don't overlap
← Swap velocity components (simplified)
This gets mathematically complex—start with one ball and floor!
Learning milestones:
- Ball falls and bounces → You understand gravity + collision response
- Ball loses energy → You understand damping
- Multiple balls bounce → You understand per-object state
- Balls collide with each other → You’ve built a physics engine!
Project 18: Scratch Internals Explorer
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch + JavaScript (for exploration)
- Alternative Programming Languages: Python, JavaScript
- Coolness Level: Level 5: Pure Magic (Super Cool)
- Business Potential: 1. The “Resume Gold”
- Difficulty: Level 4: Expert
- Knowledge Area: Language Internals / Interpretation
- Software or Tool: Scratch 3.0 source code (open source!)
- Main Book: “Language Implementation Patterns” by Terence Parr
What you’ll build: A project that helps you understand how Scratch ITSELF works—by reading the Scratch VM source code, understanding how blocks are executed, and even creating custom blocks.
Why it teaches Scratch (and beyond): This flips everything. Instead of using Scratch, you understand how Scratch is built. Scratch blocks are parsed into an AST (Abstract Syntax Tree) and interpreted. Understanding this prepares you for any programming language.
Core challenges you’ll face:
- Reading the Scratch project format (.sb3) → maps to file formats and JSON
- Understanding block representation → maps to AST concepts
- Tracing execution → maps to interpreters and VMs
- Creating extensions → maps to language extensibility
Key Concepts:
- Scratch project file format: Scratch Wiki - Scratch File Format
- Abstract Syntax Trees: Language Implementation Patterns, Chapter 4 - Terence Parr
- Scratch VM architecture: Scratch GitHub Repository - MIT
- JavaScript basics (to read source): Eloquent JavaScript - Marijn Haverbeke
Difficulty: Expert Time estimate: 2-4 weeks Prerequisites: Comfort with all Scratch concepts; basic JavaScript helpful
Real world outcome:
- You can open a .sb3 file, extract it (it’s a zip!), and read the JSON
- You understand that blocks are just JSON objects
- You can trace how a script executes in the Scratch VM
- You might even contribute to Scratch!
Implementation Hints:
Exploring the .sb3 format:
- Create a simple Scratch project and save it
- Rename file.sb3 to file.zip
- Extract it
- Open project.json - this is your entire project!
What you’ll find in project.json:
{
"targets": [
{
"name": "Sprite1",
"blocks": {
"some-id-1": {
"opcode": "event_whenflagclicked",
"next": "some-id-2",
"inputs": {}
},
"some-id-2": {
"opcode": "motion_movesteps",
"inputs": {
"STEPS": [1, [4, "10"]]
},
"next": null
}
}
}
]
}
Each block has:
opcode: The type of block (motion_movesteps, looks_say, etc.)inputs: The values in the block’s inputsnext: The ID of the next block (forming a linked list!)
Understanding execution: The Scratch VM (scratch-vm on GitHub):
- Parses project.json
- Creates Runtime and Target objects
- For each script, creates a Thread
- Executes blocks one at a time based on opcode
Experiment: Write a Python script that:
- Extracts a .sb3 file
- Parses the JSON
- Prints all blocks in a sprite
- Traces the “next” chain to show script flow
Learning milestones:
- You understand .sb3 structure → You understand file formats
- You can trace blocks in JSON → You understand program representation
- You read VM source code → You understand interpreters
- You modify a project via JSON → You’ve hacked Scratch!
Comparison Table
| Project | Difficulty | Time | Depth of Understanding | Fun Factor |
|---|---|---|---|---|
| 1. Animated Greeting Card | ⭐ | 2-3 hrs | Entry point | ⭐⭐⭐ |
| 2. Interactive Story | ⭐ | Weekend | Events, state | ⭐⭐⭐⭐ |
| 3. Dance Party | ⭐ | 3-4 hrs | Loops, concurrency | ⭐⭐⭐⭐ |
| 4. Maze Runner | ⭐⭐ | Weekend | Collision, input | ⭐⭐⭐⭐ |
| 5. Catch Falling Objects | ⭐⭐ | Weekend | Variables, cloning | ⭐⭐⭐⭐ |
| 6. Pong Clone | ⭐⭐ | 1 week | Physics, two-player | ⭐⭐⭐⭐⭐ |
| 7. Drawing Tool | ⭐⭐ | Weekend | Pen, continuous input | ⭐⭐⭐ |
| 8. Music Maker | ⭐⭐ | 1 week | Lists, sequencing | ⭐⭐⭐⭐⭐ |
| 9. Platformer | ⭐⭐⭐ | 2 weeks | Gravity, velocity | ⭐⭐⭐⭐⭐ |
| 10. Snake Game | ⭐⭐⭐ | 1-2 weeks | Lists as data structures | ⭐⭐⭐⭐ |
| 11. Flappy Bird | ⭐⭐⭐ | 1-2 weeks | Cloning, scrolling | ⭐⭐⭐⭐⭐ |
| 12. Quiz Game | ⭐⭐ | Weekend | Parallel lists, input | ⭐⭐⭐ |
| 13. Tower Defense | ⭐⭐⭐ | 2-3 weeks | Complex systems | ⭐⭐⭐⭐⭐ |
| 14. Procedural Art | ⭐⭐⭐ | 1-2 weeks | Math, recursion | ⭐⭐⭐⭐⭐ |
| 15. RPG Combat | ⭐⭐⭐ | 2 weeks | State machines | ⭐⭐⭐⭐ |
| 16. Multiplayer Game | ⭐⭐⭐⭐ | 2-3 weeks | Networking concepts | ⭐⭐⭐⭐⭐ |
| 17. Physics Engine | ⭐⭐⭐⭐ | 2-3 weeks | Math, simulation | ⭐⭐⭐⭐⭐ |
| 18. Scratch Internals | ⭐⭐⭐⭐ | 2-4 weeks | Language design | ⭐⭐⭐⭐ |
Recommended Learning Path
If you’re a complete beginner:
- Start with Projects 1-3 (Greeting Card, Story, Dance Party) - Learn the basics
- Move to Projects 4-5 (Maze, Catch Game) - Learn game mechanics
- Challenge yourself with Project 6 (Pong) - Your first “real” game
- Branch based on interest:
- Art → Projects 7, 14
- Music → Project 8
- Games → Projects 9, 10, 11, 13
- Logic puzzles → Projects 12, 15
If you have some programming experience:
- Skim Projects 1-3 quickly to understand Scratch’s interface
- Jump to Project 6 (Pong) - Prove your fundamentals
- Tackle Project 9 (Platformer) - This is the test
- Then explore advanced: Projects 13, 15, 16, 17, 18
Time-limited path (want results fast):
- Project 1 (2 hours) - Understand basics
- Project 4 (weekend) - First game
- Project 6 (1 week) - Classic game
- Project 9 (2 weeks) - Serious game
Final Project: Build Your Own Game from Scratch
- File: LEARN_MIT_SCRATCH_PROGRAMMING.md
- Main Programming Language: Scratch
- Alternative Programming Languages: Godot, Unity, Pygame
- Coolness Level: Level 5: Pure Magic (Super Cool)
- Business Potential: 4. The “Open Core” Infrastructure
- Difficulty: Level 4: Expert
- Knowledge Area: Game Design / Software Architecture
- Software or Tool: MIT Scratch 3.0
- Main Book: “The Art of Game Design” by Jesse Schell
What you’ll build: A complete, original game of your own design—not following any tutorial. You decide the concept, mechanics, art, and sound.
Why this is the ultimate test: Tutorials teach you to follow instructions. This project forces you to make decisions. When something doesn’t work, there’s no guide—you figure it out. This is what programming really is.
Core challenges you’ll face:
- Game design decisions → maps to requirements and scope
- Technical architecture → maps to system design
- Debugging complex interactions → maps to real debugging
- Polish and game feel → maps to user experience
Key Concepts:
- All previous concepts combined
- Game design fundamentals: “The Art of Game Design” - Jesse Schell
- Project management: Breaking big goals into tasks
- Iteration: Build, test, improve
Difficulty: Expert Time estimate: 1 month+ Prerequisites: Completion of at least 8-10 projects from this list
Real world outcome:
- A game you’re proud to share
- Something in your Scratch profile that shows your skills
- A portfolio piece that demonstrates you can build software
- Confidence to tackle any programming challenge
Implementation Hints:
Step 1: Ideation (1-2 days)
- What kind of games do you enjoy playing?
- What’s a simple mechanic you find interesting?
- Constraint: Keep scope small! One core mechanic, done well.
Step 2: Paper prototype (1 day)
- Sketch your game on paper
- Define: player goals, controls, win/lose conditions
- List sprites you’ll need
Step 3: Core mechanic first (1 week)
- Build ONLY the main gameplay loop
- No menus, no sound, no polish
- Ask: “Is this fun yet?”
Step 4: Iterate (ongoing)
- Playtest with friends
- Listen to feedback
- Improve what’s weak
Step 5: Polish (1 week)
- Add sound effects
- Add visual feedback (screen shake, particles)
- Create title screen and game over screen
- Add instructions
Step 6: Share (ongoing)
- Publish on Scratch
- Get feedback from the community
- Update and improve
Learning milestones:
- You have an idea → You understand game design basics
- Core mechanic works → You can build from scratch (pun intended)
- Game is polished → You understand UX and feedback
- Game is published → You’re a game developer!
What’s Next After Scratch?
Once you’ve mastered these projects, you’re ready to transition to text-based programming. The concepts you’ve learned map directly:
| Scratch Concept | Text Programming |
|---|---|
| when green flag clicked | main() / program entry |
| forever | while(true) / game loops |
| repeat 10 | for loops |
| if-then-else | if/else statements |
| variables | variables (same!) |
| lists | arrays/lists |
| My Blocks | functions |
| clones | object instantiation |
| broadcasts | events/pub-sub |
Recommended next steps:
- Python - Closest to Scratch’s friendliness → Try “Automate the Boring Stuff”
- JavaScript - Build web games → Try “Eloquent JavaScript”
- Godot (GDScript) - Natural progression for game development
- Processing/p5.js - Creative coding, like Scratch’s Pen but more powerful
You’re not “graduating” from Scratch—you’re expanding your toolbox. Many professional developers prototype in Scratch because it’s so fast!
Resources Summary
Official Resources
- Scratch Official Website - Where everything happens
- Scratch Wiki - Community documentation
- MIT Scratch Tutorials - Official learning materials
Courses
- Harvard CS50’s Introduction to Programming with Scratch - University-level introduction
- Class Central’s Best Scratch Courses - Curated course list
Books
- “Learn to Program with Scratch” by Majed Marji - Best beginner book
- “Advanced Scratch Programming” by Abhay B. Joshi - For intermediate/advanced
- “Computer Programming and Game Design with Scratch” - Games for Change curriculum
Video Tutorials
- Griffpatch (YouTube) - The master of advanced Scratch techniques
- CS50 Scratch lectures - Conceptual understanding
Community
- Scratch Studios - Browse and learn from others
- Scratch Forums - Ask questions, get help
Summary
| # | Project | Main Language |
|---|---|---|
| 1 | Animated Greeting Card | Scratch |
| 2 | Interactive Storyteller | Scratch |
| 3 | Dance Party | Scratch |
| 4 | Maze Runner | Scratch |
| 5 | Catch the Falling Objects | Scratch |
| 6 | Pong Clone | Scratch |
| 7 | Drawing Tool (Etch-a-Sketch) | Scratch |
| 8 | Music Maker / Drum Machine | Scratch |
| 9 | Platformer Game | Scratch |
| 10 | Snake Game | Scratch |
| 11 | Flappy Bird Clone | Scratch |
| 12 | Quiz Game | Scratch |
| 13 | Tower Defense Game | Scratch |
| 14 | Procedural Art Generator | Scratch |
| 15 | RPG Combat System | Scratch |
| 16 | Multiplayer Game (Cloud Variables) | Scratch |
| 17 | Build a Physics Engine | Scratch |
| 18 | Scratch Internals Explorer | Scratch + JavaScript |
| Final | Build Your Own Game from Scratch | Scratch |
Happy Scratching! Remember: every professional programmer started somewhere. Scratch teaches you the hardest part—thinking like a programmer. The syntax of other languages is just details.
🐱 The Scratch Cat believes in you.