Today you will use one variable to remember the current game screen and switch between start, play, and game over.
1 Warm-Up
2 Predict
3 Try It
4 Plan
5 Build
6 Fix It
7 Extend
8 Math Challenge
For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-11 · CSTA 2-AP-12 · ISTE 1.5.c · ISTE 1.4.d · Standards
| 🎯 I can | use one variable to remember the current game screen and switch between start, play, and game over |
| 📝 New words | 6 words |
| ⏱ Lesson time | ~45 min |
Teacher Guide
📋 Before class
⚠️ Common misconceptions
- Students use many true/false variables (on_start, on_play) instead of one
game_statevariable. One word variable is cleaner and stops impossible mixes like on_start = true AND on_play = true. - Students change the screen inside the wrong branch. The screen change belongs in its own check: if
game_state= play AND the game ends, setgame_stateto game over. - Students think a broadcast is needed to change screens. You can change a screen by just setting the
game_stateword. A broadcast is only needed if another sprite must react.
🎯 Differentiation
🐢 Struggling: Start with two screens only (start and play). Add game over after the two-screen version works correctly.
🚀 Advanced: Add a second sprite that reads the same game_state word and shows or hides itself, so it only appears on the play screen.
💡 During the lesson
- Warm-UpBefore the lesson, draw three boxes on the board (start, play, game over) with arrows between them. Ask students: "Can the game show start AND play at the same time?" (No.) "How does the game go from play to game over?" (When the player loses.) This motivates using one word to remember the current screen.
- Try ItThe key distinction: the screen loop runs every frame (it reads the
game_stateword and shows the right picture). The switches fire only when a key is pressed (they write a newgame_stateword). Keeping the two jobs apart makes the code easier to read and fix. Keep the screen loop and the switches as separate scripts.
Fix It shows a bare switch with no screen check: space jumps straight to game over from the start screen. The second experiment shows that the screen check stops space from ending the game on the start screen. The lesson: a screen switch should check both the key AND the current screen. - PlanThe screen diagram is the most valuable artifact in this lesson. Have students draw it on paper before they open Scratch. A student who can draw a correct screen diagram can build the code; a student who cannot draw it will write tangled if-statements that break unpredictably.
- BuildThis is the most important build in the chapter. Allow 15 minutes. Students who finish early should draw the screen diagram for their actual running code and check if it matches the plan. Discrepancies reveal bugs. The enemy that triggers game over is left for Extend so the required build stays focused on three screens.
Show the picture first. Ask what will happen — everyone points or says one word.
Everyone picks an answer first. Then press the flag together.
Change one thing at a time. Run it, watch, then change the next thing.
Pairs put the cards in order before anyone opens Scratch.
Students build step by step. Walk around — help with questions, not with the mouse.
Ask: what did we want, and what did it do? Let them find it.
Fast finishers pick the next tier. Everyone else finishes their build.
Work it out on paper first. Then check it on the stage.