Level 5

Where Am I?

Level 5 · Chapter 1

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

Also practised: 2-AP-17

Common Core State Standards for Mathematics

The Number System · Grade 6

Use negative numbers on the number line.

Code 6.NS.C.8Read 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 a sprite's live state with position and direction reporters, and read the keyboard with a key-pressed Boolean.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-12 · CSTA 2-AP-17 · ISTE 1.5.c · Standards
🎯 I canread a sprite's live state with position and direction reporters, and read the keyboard with a key-pressed Boolean
🧩 New blocks4 blocks
📝 New words8 words
⏱ Lesson time~40 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students often try to use (x position) as a command block — it is a reporter, not a stack block. It cannot stand alone in a script.
  • Students may think x position updates only when the sprite moves. Clarify: it is always current — the value at any moment the block is evaluated.
  • Students often confuse the hat block when [right arrow ▾] key pressed (Level 1 Ch6) with the Boolean reporter introduced here. The hat block starts its own script once when the key goes down; the Boolean reports true or false and cannot start anything — it must be plugged into an if, which is why it is re-checked every pass of the forever loop.

🎯 Differentiation

🐢 Struggling: Show the Stage coordinate grid with labeled axes. Have students physically place Pico at x:0 y:0 (center), x:240 y:0 (right edge), x:-240 y:0 (left edge) before writing any code.

🚀 Advanced: Challenge students to save two spots with the same y and make Pico say how far apart they are, using x position and the subtract block — then test it with one spot left of the center and one right of it.

💡 During the lesson

  • Warm-UpDisplay the Scratch stage with its coordinate overlay (View → Show). Ask: "Where is the center? Where is the right edge? What is the y value at the very top?" This grounds the abstract numbers before any coding.
  • Try ItContrast the rounded reporter shape with the rectangular command block shape. Ask: "Can you place (x position) alone in a script — as the first block?" No — it has no notch. It must plug into something that expects a number.
    In the first experiment, pick direction: Pico says -90 because it faces left — 90 is right. The third experiment makes the difference between a live reporter and a stale variable visible — y_saved stops following Pico because nothing writes to it inside the loop.
  • PlanAsk students to trace through the flowchart before building. Where does x_saved get its first value? (Set to 0 at start.) What happens if 'r' is pressed before space? (Glides to 0, 0 — the initial value.)
  • BuildStep 6 introduces the key pattern: reporters used as the *source* in a set block. Step 8 uses saved variables as coordinates in glide — a direct application of storing and replaying position data.