- Learnt27 min · a ball, a paddle, and a bounce you control
- Basic25 min · build the rally
- Challenge 1–327 min · your court, no stuck balls, a good rally
- Extrabonus · two balls, one paddle
Review — where we got to 5 min
Jump Dash is finished and shared. We bring two of its ideas with us.
- A controller:
foreverwith anif <key [right arrow v] pressed?> theninside it. - A title screen and a button. This game gets them in three weeks.
Quick-fire
The hare hopped when you pressed a key. What does the ball do if you press nothing?
Reveal the answer
It keeps going. This game runs on its own. You have to keep up with it.
Today’s Topic 3 min
move (6) stepsandif on edge, bouncein a forever loop.- Direction: which way 90 points, and which way 0 points.
- A paddle that only moves along one line.
- A bounce off the paddle. You choose it, not the edge.
Learning outcome
By the end of this lesson you will be able to:
- Send a ball round the Stage for ever without it stopping.
- Steer a paddle left and right along the bottom.
- Bounce the ball off the paddle in a direction you decide.
Learnt — a ball, a paddle, a bounce 27 min
1 · A ball that never stops
The whole ball is two blocks in a forever loop. The rest of the game is built on those two.
- Start a new project. Delete the cat. Choose the Neon Tunnel backdrop.
- Add the Ball sprite. Set its size to
70. - Start it in the middle with
go to x: (0) y: (0). - Point it a random way with
point in direction (pick random (45) to (135)). - Add a
foreverloop. Putmove (6) stepsandif on edge, bounceinside it. - Press the flag and watch it for a minute.
when flag clicked
go to x: (0) y: (0)
point in direction (pick random (45) to (135))
forever
move (6) steps
if on edge, bounce
end
How to use this: Click the green flag and watch the ball bounce. Nothing to press — press the flag again and it starts off in a new direction.
2 · A paddle on a line
You have built a controller like this four times now. The only new thing: it has no up or down, on purpose.
- Add the Paddle sprite.
- Put it on its line:
go to x: (0) y: (-140). - Build a
foreverloop with two ifs in it. One is for left, one for right. - Add
if on edge, bounceso it cannot leave the Stage. - Press the flag. Click the Stage. Then slide the paddle about.
when flag clicked
set rotation style [don't rotate v]
go to x: (0) y: (-140)
forever
if <key [left arrow v] pressed?> then
change x by (-12)
end
if <key [right arrow v] pressed?> then
change x by (12)
end
if on edge, bounce
end
change y by (10) anywhere. The paddle stays on one line. That is what makes the game hard.How to use this: Click the green flag, click the stage once, then hold ← or → to slide the paddle. It stops at both walls.
3 · The bounce you choose
The wall decides a wall bounce. You decide a paddle bounce. That is what makes it a game.
- Go back to the ball. Find its forever loop.
- Add
if <touching [Paddle v]?> thenunder the bounce. - Inside it, point the ball up:
point in direction (pick random (-45) to (45)). - Then add
move (12) steps. This gets it off the paddle. - Play. Keep it up for as long as you can.
forever
move (6) steps
if on edge, bounce
if <touching [Paddle v]?> then
start sound [Boing v]
point in direction (pick random (-45) to (45))
move (12) steps
end
end
How to use this: Click the green flag, click the stage once, then hold ← or → to slide the paddle under the ball. Nothing is lost yet — the floor still bounces.
Basic — build the rally 25 min
Build the ball first. You cannot test a paddle with nothing to hit.
Step 1 — the ball
- Start a new project. Delete the cat. Pick a dark backdrop.
- Add the ball. Make it smaller. Start it in the middle.
- Build the move-and-bounce loop.
- Watch it for a whole minute. It must never stop.
Step 2 — the paddle
- Add the paddle and put it on its line.
- Set its rotation style first.
- Build the two ifs and test both keys.
Step 3 — the bounce
- Add the touching question inside the ball’s loop.
- Point it up and move it off the paddle.
- Play for a minute. Count your bounces.
Step 4 — tune it
- Too fast to hit? Take the ball down to 4 steps.
- Too easy? Take it up to 9.
- Change one number. Play. Then change the next.
Step 5 — the sound
- Give the paddle bounce a sound. Give the wall bounce a different sound.
- Close your eyes and listen to a rally. Can you follow it by sound?
The ball goes straight up and down for ever.
The random direction was close to 0 or 180. Make the range smaller. Then it always starts at a slant.
The ball shakes on top of the paddle.
The move after the bounce is missing, or too small. It must take the ball right off the paddle in one go.
The paddle spins.
set rotation style [don’t rotate v] is missing from the flag stack.
The ball goes through the paddle when it is moving fast.
Six steps at a time can jump right over a thin paddle. Slow the ball down, or use a taller paddle costume.
Your court
Pick a place for this game. Make sure you can see the ball in it.
- A backdrop you chose.
- A ball you can follow across every part of it.
- A paddle that looks like it belongs to the same game.
A ball that never gets stuck
This ball can get stuck in two ways. Find them both. Then make sure neither can happen.
- The ball never moves flat along a wall.
- The ball never sits on the paddle shaking.
- To prove it, leave the game running for two minutes.
Teacher note — the flat ball, and why it is worth finding
A ball pointing at exactly 90 bounces left and right along the same line for ever. Ranges like pick random (45) to (135) avoid it at the start, but a paddle bounce can still produce it if the range includes 90 or −90.
This is a pupil’s first meeting with an edge case: a value that is legal, sensible, and ruins everything. Worth naming out loud.
Twenty bounces worth watching
Count your bounces and get to twenty. Then look at where each bounce went.
- A counter on the Stage. It goes up on every paddle bounce.
- Twenty in one rally.
- No two bounces sent the ball to the same place.
Teacher note — the counter is next week’s score
A variable set to 0 on the flag and changed by 1 inside the paddle if. It is the same shape as Jump Dash’s score, and next week it becomes one.
Two balls, one paddle
One ball is a rally. With two balls, you have to choose all the time. Which one can you still reach?
How to use this: Click the green flag, click the stage once, then hold ← or →. Two balls, one paddle — you have to choose which one to chase.
- Two balls on the Stage, both bouncing properly.
- They start in different places, going different ways.
- Both bounce off the paddle.
- They can pass each other without getting stuck together.
Teacher notes — two sprites or two clones
Duplicating the ball sprite is the straightforward answer and works perfectly. A pupil who tries clones will find that a clone runs the same loop happily — this is a good place to notice that clones are just copies that run the same code.
Balls colliding with each other is not required and is genuinely hard. If a pupil asks, the honest answer is that it needs more than Level 1 has.
Going further: next lesson the floor stops bouncing, and the ball can be lost.
Summary 4 min
The game runs on its own. The player has to keep up with it.
move (6) stepsplusif on edge, bouncein a forever loop is a ball.- Direction goes round like a clock, from straight up. 0 is up and 90 is right.
- The paddle moves along one line and never changes its y.
- After a paddle bounce, move the ball off the paddle. If not, it bounces again.
- Direction
- Which way a sprite faces. 0 up, 90 right, 180 down, −90 left.
- Bounce
- Turning the ball round. The wall decides a wall bounce. You decide a paddle bounce.
- Rally
- A run of bounces with no miss in it.
- Rotation style
- If a sprite is allowed to turn. A paddle is not.
Next lesson: the floor stops bouncing. If you miss, it costs you.