Level 5

Touching That Color?

Level 5 · Chapter 9

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

Expressions & Equations · Grade 6

Solve an equation with one unknown.

Code 6.EE.B.7Read 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 color-is-touching-color detection for precise collision logic.

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 canuse color-is-touching-color detection for precise collision logic
🧩 New blocks2 blocks
📝 New words6 words
⏱ Lesson time~40 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students often confuse touching color? with color is touching color?. The first checks if a sprite touches any pixel of a color. The second checks if a specific color ON the sprite touches a specific color elsewhere — much more precise.
  • Students may try to use the color picker and select a color that looks correct but is slightly off. Guide them to click directly on the exact pixel they want.
  • Students put clone behavior under when flag clicked instead of when I start as a clone. The spawner script and the clone script are two separate scripts on the same sprite.

🎯 Differentiation

🐢 Struggling: Have students focus only on the feet-to-platform detection first. Skip coins until the basic platformer collision works.

🚀 Advanced: Challenge them to add a double-jump that only activates when the feet color is NOT touching the platform — detecting when the player is airborne.

💡 During the lesson

  • Warm-UpAsk: "Why would it be a problem to use one sensor for everything?" Lead toward: a character might need to stand on a platform (feet) while also being near a wall (side). One sensor cannot tell these apart.
  • Try ItShow students the Pico Walking costume and the feet you painted gold and the body you painted blue. Block 2 lets you say: "Is the yellow (feet) touching the brown (platform)?" The specificity is the key concept here.
    The third experiment reinforces AND logic — the message fires only when both color pairs match. At height -60 the body touches the spike but the feet are in the air, so the AND is false. Ask what happens if you remove the gate entirely, so students see why the IF block is the gatekeeper. Scratch color detection is very strict, so encourage the eyedropper tool over typed hex.
  • PlanWalk through the flowchart before students open Scratch. Ask: "Why do we have three separate IF checks instead of one?" Answer: each check watches a different color interaction. One combined check would be impossible to write clearly. The Ball branches are review, not new material: clones came in L3 ch10 and L4 ch12, custom blocks in L4 ch6 and L4 ch13. Pico's existing red check needs no edit — a red clone is just more red on the stage.
  • BuildThe color picker (eyedropper) is critical. Students who type hex codes manually will likely get slight mismatches. Require them to use the eyedropper on the actual drawn pixel. Also note: if the sprite shrinks, the costume pixel positions shift — color detection can break at very small sizes. Steps 11–12 are deliberate review of clones (L3 ch10, L4 ch12) and custom blocks (L4 ch6, L4 ch13) — the capstone in ch14 spawns bullet clones from a custom block, so this is the rehearsal for it. The teaching point here stays color detection: the moving red clone proves <color is touching color?> reads sprites, not just painted backdrop shapes.