Level 6

Game Screens

Level 6 · Chapter 2

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Name variables well and work with their values.

Code 2-AP-11Read the official text

Also practised: 2-AP-12

Common Core State Standards for Mathematics

Expressions & Equations · Grade 6

Solve an equation with one unknown.

Code 6.EE.B.5Read the official text

The short lines are our own words. We matched this lesson to these standards ourselves; the standards' owners have not reviewed or endorsed this course.

Common Core State Standards © 2010 National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

Today you will use one variable to remember the current game screen and switch between start, play, and game over.

1👋 Warm-Up

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 canuse one variable to remember the current game screen and switch between start, play, and game over
📝 New words6 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_state variable. 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, set game_state to game over.
  • Students think a broadcast is needed to change screens. You can change a screen by just setting the game_state word. 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_state word and shows the right picture). The switches fire only when a key is pressed (they write a new game_state word). 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.