Today you will detect how far a sprite is from another sprite or mouse.
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 1B
✦ CSTA 1B-AP-10 · CSTA 1B-AP-15 · ISTE 1.5.a · Standards
| 🎯 I can | detect how far a sprite is from another sprite or mouse |
| 🧩 New blocks | 1 block |
| 📝 New words | 6 words |
| ⏱ Lesson time | ~40 min |
Teacher Guide
📋 Before class
⚠️ Common misconceptions
- Students use
(distance to [mouse-pointer ▾])directly insideif <>without a comparison — distance is a number, not a true/false value. - Students expect smaller numbers to mean 'far away.' Remind them: 0 pixels = touching, 200 pixels = very far.
🎯 Differentiation
🐢 Struggling: Draw two dots on paper labeled 'Cat' and 'Mouse.' Measure the gap with a ruler. Explain that Scratch measures the same gap in pixels.
🚀 Advanced: Add a second sprite (Dog2). Use distance to [Dog2 ▾] — cat reacts differently to dog vs. mouse. Chain two if blocks.
💡 During the lesson
- Warm-UpAsk students: "How does a car know it is near a wall?" Accept answers. Introduce the word "sensor." Tell them their code will be a sensor today. Optionally, hold up a ruler and ask: "How do we measure distance?" (Units — in Scratch they are pixels.)
Ask: "What is the cat doing in frame 2?" (Waiting, measuring.) "What changed in frame 3?" (The mouse came close — the distance dropped below 50 pixels.) Students should point to the frame that shows the condition becoming true. - Try ItHold up
distance to [mouse-pointer ▾]. It is a round block — a number. It reports how many pixels away the mouse is, updated every loop. Pair it with< (50)to ask a true/false question.
Ask: "In the third experiment, what new thing happens?" (The cat grows.) Reset the size withset size to (100) %at the start if students want to retry. Connect to a parking sensor: not only does it beep, the beep gets louder as the car comes near — two reactions to one condition. - PlanDo the first box together. Pick, then watch both stages. After the plan, ask: "What happens if the mouse is 60 pixels away?" (Nothing — condition is false, the loop just keeps checking.) This reinforces the loop-and-check pattern.
- BuildMost common error: students try to drop
distance tostraight into theifslot — it will not snap in, because the round block does not fit the six-side hole. Show them:distance tohas a round shape (number), butifneeds a six-side shape (true/false). They must connect the round block to a comparison block first.
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.