- Learnt28 min · the rows, lanes of clones, the hop, the hit
- Basic24 min · build the first crossing
- Challenge 1–327 min · hop, fill the road, get home
- Extrabonus · count the cars on the road
Review — the Times-Table Challenge 5 min
(pick random (2) to (12))made a new question every time.- A timer counted down, and the game ended at zero.
- A streak counted right answers in a row.
- A wrong answer set the streak back to 0.
Quick-fire
Your streak is 7. You get one wrong. Which block runs?
Reveal the answer
set [streak v] to (0). The streak goes back to where it started. Today a frog does the same thing: when a car hits it, it goes back to the start.
Today’s Topic 3 min
- A game drawn as rows
- One Car sprite, many clones, three lanes
- A clone that drives across and deletes itself
- A frog that hops one row per key press
- Hit by a car? Back to the start.
Learning outcome
By the end of this lesson you will be able to:
- Fill three lanes with clones of one sprite.
- Make each clone drive across and delete itself at the edge.
- Make a sprite hop one row per key press, and go back to the start when hit.
Learnt — a road full of clones 28 min
The game, as rows
This game is built on a grid. The ground is nine rows. Each row is 40 steps tall. One hop moves the frog one row.
| Row | y | What is there |
|---|---|---|
| Far bank | 160 | Where the frog wants to go. |
| Park | 120, 80, 40 | Safe grass. In Lesson 2-35 it becomes a river. |
| Sandy strip | 0 | Safe. A place to rest. |
| Road | −40, −80, −120 | Three lanes of cars. |
| Pavement | −160 | Where the frog starts. |
One Car, many clones
You met clones in the Shooting Game. One sprite made every bullet and every zombie. Today one Car sprite makes all the traffic.
A clone is born as a copy of its parent. It starts in the same place, with the same costume and the same size. So the parent goes to the lane first, then makes the clone.
when flag clicked
hide
set size to (40) %
Then one stack for each lane. They are the same stack with two numbers changed:
when flag clicked
forever
go to x: (-230) y: (-120)
create clone of [myself v]
wait (2) seconds
end
when flag clicked
forever
go to x: (-230) y: (-80)
create clone of [myself v]
wait (3) seconds
end
when flag clicked
forever
go to x: (-230) y: (-40)
create clone of [myself v]
wait (2.5) seconds
end
The y picks the lane. The wait picks the gap between cars. Different waits make the lanes feel different.
Drive across, then delete
Every clone runs this stack the moment it is born:
when I start as a clone
switch costume to (pick random (1) to (3))
show
repeat until <(x position) > (235)>
change x by (3)
end
delete this clone
switch costume to (pick random (1) to (3))— drop the green Operators block into the costume slot. Each car gets a green car, a truck or a purple car.show— the parent was hidden, so the clone was born hidden too.repeat until <(x position) > (235)>drives it until it has left the road.delete this clone— it is gone for good.
How to use this: Click the green flag to start it. Nothing else to press — watch the lanes fill, then use ↺ Reset to run it again.
The hop
In the Car Race you drove with key [up arrow v] pressed? inside a forever loop. That was right for a car. A car keeps moving while you hold the key.
A frog is different. One tap is one hop. So the frog uses the Events hat instead.
when [up arrow v] key pressed
change y by (40)
forever
if <key [up arrow v] pressed?> then
change y by (40)
end
end
Now all four arrows. Up and down each ask a question first:
when [up arrow v] key pressed
if <(y position) < (160)> then
change y by (40)
end
when [down arrow v] key pressed
if <(y position) > (-160)> then
change y by (-40)
end
when [left arrow v] key pressed
change x by (-40)
when [right arrow v] key pressed
change x by (40)
Without the two if <> then blocks, the frog could hop off the grid. Then every row after that is a little bit wrong.
How to use this: Click the green flag, then click the Stage once and tap ↑ ↓ ← → to hop the Frog one row at a time.
Hit! Back to the start
The frog keeps asking one question. When the answer is yes, it goes home to the pavement.
when flag clicked
go to x: (0) y: (-160)
forever
if <touching [Car v]?> then
go to x: (0) y: (-160)
end
end
touching [Car v]? is true for ANY clone of Car. You do not have to name them.How to use this: Click the green flag, then click the Stage once and tap ↑ ↓ ← → to hop the Frog across the road.
Basic — build the first crossing 24 min
Start a new project. Build in this order, and test after every step.
Step 1 — paint the ground
- Click the Stage, then the Backdrops tab. Use the rectangle tool.
- Paint a pale pavement strip along the bottom.
- Paint a wide grey road above it — three lanes tall.
- Add a sandy strip, then green grass, then a darker far bank at the top.
- Draw white dashes between the lanes, if you like.
It does not have to be exact. The lanes need to sit near y = −120, −80 and −40.
Step 2 — the Frog
- Choose a Sprite → Frog. Set its size to 45.
- Add the four hop stacks from above.
- Tap each arrow. Every tap should move one row, and only one.
Step 3 — the Car
- Choose a Sprite → Convertible 2. Rename it Car.
- In the Costumes tab, choose a costume → Truck-a. Choose another → Convertible. Now Car has three costumes.
- Keep that order: green car, truck, purple car. Lesson 2-34 needs it.
- Add the setup stack: hide, and size 40.
Step 4 — one lane
- Build the Lane 1 stack.
- Build the clone stack.
- Click the flag. Cars should drive along the bottom lane and vanish on the right.
Step 5 — three lanes
- Right-click the Lane 1 stack → Duplicate. Do it twice.
- Change the y to −80 and −40. Change the waits to 3 and 2.5.
Step 6 — the hit
- Add the frog’s forever stack.
- Hop into a car on purpose. The frog should jump back to the pavement.
Step 7 — play it
Cross five times. If it is too easy, make the waits shorter. Too hard? Make them longer.
How to use this: Click the green flag, then click the Stage once and tap ↑ ↓ ← → to hop the Frog across the road.
No cars appear at all.
The clone stack has no show. The parent is hidden, so every clone is born hidden too.
The frog flies to the top when I hold ↑.
You used key [up arrow v] pressed? in a forever loop. Use the hat when [up arrow v] key pressed instead.
The cars stop coming after a few minutes.
A clone is not deleting itself. Check delete this clone is under the repeat, not inside it.
The frog goes back to the start when nothing hit it.
The parent Car is visible. Make sure the setup stack says hide.
Hop, never fly
- All four arrows hop the frog exactly one row or one step of 40.
- Holding a key never sends the frog flying.
- The frog cannot hop below the pavement or above the far bank.
How to use this: Click the green flag, then click the Stage once and tap ↑ ↓ ← → to hop the Frog one row at a time.
Three lanes of traffic
- One Car sprite. Everything you see is a clone.
- Three lanes, each with its own gap between cars.
- Cars never stop coming, and none get stuck at the edge.
How to use this: Click the green flag to start it. Nothing else to press — watch the lanes fill, then use ↺ Reset to run it again.
Teacher reveal — the Car sprite
when flag clicked
hide
set size to (40) %
when flag clicked
forever
go to x: (-230) y: (-120)
create clone of [myself v]
wait (2) seconds
end
when I start as a clone
switch costume to (pick random (1) to (3))
show
repeat until <(x position) > (235)>
change x by (3)
end
delete this clone
Plus two more lane stacks at y −80 and −40. The trap is the gap: a wait shorter than about 1.5 seconds puts a truck on top of the car in front. Let pupils find that by trying it.
Back to the start — or home
- A car sends the frog back to the pavement.
- Reaching the far bank makes the frog say something.
- Then the frog goes back to the pavement to cross again.
How to use this: Click the green flag, then click the Stage once and tap ↑ ↓ ← → to hop the Frog to the far bank.
Teacher reveal — a second forever stack
when flag clicked
forever
wait until <(y position) > (140)>
say [Made it!] for (1) seconds
go to x: (0) y: (-160)
end
A second stack on the frog, so the hit loop stays short. The test is <(y position) > (140)>, not = 160: a frog pushed a pixel or two off the grid still counts.
Rush-hour counter
How many cars are on the road right now? Make the game count them, live, on the Stage.
- A variable shows the number of cars on the road.
- It goes up when a car appears, and down when a car leaves.
- It is 0 every time you click the flag.
How to use this: Click the green flag, then click the Stage once and tap ↑ ↓ ← → to hop the Frog. Watch the cars on road box.
Teacher reveal
when flag clicked
hide
set size to (40) %
set [cars on road v] to (0)
when I start as a clone
change [cars on road v] by (1)
switch costume to (pick random (1) to (3))
show
repeat until <(x position) > (235)>
change x by (3)
end
change [cars on road v] by (-1)
delete this clone
cars on road must be For all sprites: every clone adds to the same box. A pupil who puts the −1 below the delete sees the number climb for ever — a deleted clone runs nothing, not even the next block.
Summary 5 min
- A grid of 40-step rows keeps every hop in the middle of a lane.
- A clone is born as a copy of its parent: same place, costume and size.
- So the parent goes to the lane first, then makes the clone.
- A clone drives with
repeat until <>, thendelete this clone. - A hop is a hat block. A drive is a forever loop.
touching [Car v]?is true for every clone of Car.
- Clone
- A copy of a sprite, made while the game runs.
- Parent
- The sprite that made the clone. Here it hides.
- Lane
- One row of the road. Its y tells a car where to drive.
- Hop
- One jump of exactly one row, one per key press.
Hand in
Share your crossing and send the link to your teacher. Next lesson every lane gets its own speed — and one lane drives the other way.