Level 5

Which Scene Am I In?

Level 5 · Chapter 8

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Combine loops and conditions, even nested ones.

Code 2-AP-12Read the official text

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 read the current backdrop name or number to drive scene-based logic.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-12 · ISTE 1.5.c · Standards
🎯 I canread the current backdrop name or number to drive scene-based logic
🧩 New blocks1 block
📝 New words6 words
⏱ Lesson time~40 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students expect backdrop name to return a number, or backdrop number to return a name. The dropdown selects which property is returned.
  • Students use backdrop number for comparisons but name is more readable and less error-prone when backdrops are reordered.
  • Students think event_whenbackdropswitchesto and checking backdrop name inside a loop are equivalent — they have different timing. The event fires once at the moment of switch; the loop checks every frame.

🎯 Differentiation

🐢 Struggling: Build only 2 scenes (menu + game). Show how backdrop name changes the say message. Add the third scene as an extension.

🚀 Advanced: Challenge them to remove the state variable entirely — use only backdrop name for all branching. Can every if condition be replaced by a backdrop name check?

💡 During the lesson

  • Warm-UpAsk: "In your favorite game, how many different 'screens' does it have?" (Title screen, level select, gameplay, pause menu, game over, credits.) This makes the concept concrete before touching code. The key insight: every screen has a name, and the game's code reads that name to decide what to do.
  • Try ItShow the backdrop list in Scratch. Click each backdrop and point out its name in the name field at the top. Rename "backdrop1" to "menu", "backdrop2" to "game", "backdrop3" to "gameover". Emphasize: the name in that field is exactly what backdrop [name ▾] returns. Spelling must match — a typo or a stray space breaks the check. Capital letters do not: Scratch's = ignores them.
    The backdrop number is the critical case: inserting a backdrop before "game" changes its number from 2 to 3, silently breaking the condition. Name comparison is more robust. This is a real software maintenance lesson — "magic numbers" in code are fragile; named constants (or in this case, named backdrops) are safer.
  • PlanThe flowchart shows a complete state machine. Every arrow is a transition triggered by a condition. This is the same pattern used in professional game engines — Unity calls this a "State Machine" component. The flowchart habit at L5 prepares students to read and write formal state diagrams at L6.
  • BuildStep 10 deliberately introduces a bug for students to find and fix. This is an important hands-on lesson about string matching precision. Ask two questions and let the board answer: "If the backdrop is named Game but the condition checks game, what happens?" — it still matches, because Scratch's = ignores capital letters. "And if the backdrop is named gam?" — now the condition is false and Pico's script never runs in the game scene. The lesson is *which* differences matter.