- Learnt28 min · the aim, the bullet, the wave
- Basic24 min · build the first draft
- Challenge 1–327 min · move, shoot, defend
- Extrabonus · design it properly
Review — the Car Race, finished 5 min
- A broadcast says where to go; a variable says what was chosen.
- Give every setting a default before the player sees anything.
- A My Block is worth making even with no inputs.
- Clones let one sprite be in many places at once.
Quick-fire
You have one sprite and you need twenty of them on screen at once. What do you reach for?
Reveal the answer
Clones. You will use them twice today — once for the bullets and once for the skeletons.
Today’s Topic 3 min
- Planning a game before building it
- Aiming with the mouse
- A bullet that knows where it is going
- Enemies that keep coming
Learning outcome
By the end of this lesson you will be able to:
- Make a sprite face the mouse pointer.
- Fire a clone that travels in a straight line and cleans itself up.
- Spawn enemies at random and remove them when they are hit.
Learnt — a game you aim 28 min
The rules, before the blocks
You have built two games now. Both times, deciding the rules first made the building easier. So here are ours:
- You move with the arrow keys.
- Your aim always follows the mouse.
- Click to shoot. The bullet goes where the aim was pointing.
- Enemies come from the left, at random, for ever.
That is all. Four rules is a game. Everything after that is polish.
Aiming with the mouse
Two sprites, two blocks. A crosshair that sits on the pointer, and a player that turns to face it.
when flag clicked
go to [front v] layer
forever
go to [mouse-pointer v]
end
set rotation style [left-right v]
forever
point towards [mouse-pointer v]
end
left-right stops the knight standing on his head when you aim behind him.Firing a bullet
When the mouse goes down, the player makes a clone of the Bullet sprite:
when flag clicked
forever
wait until <mouse down?>
create clone of [Bullet v]
wait until <not <mouse down?>>
end
wait until <not <mouse down?>> pattern as the Whack-a-mole hammer.And the clone puts itself in the right place and points itself the right way:
when I start as a clone
go to [Player v]
point towards [mouse-pointer v]
go to [front v] layer
show
repeat until <(x position) > (235)>
move (7) steps
end
delete this clone
point towards [mouse-pointer v] happens once, right at the start. After that the bullet just goes straight.Enemies that keep coming
One sprite does all of them. The original never appears — it just makes clones:
when flag clicked
hide
forever
wait (pick random (0.8) to (2.5)) seconds
go to x: (-210) y: (pick random (-140) to (140))
create clone of [myself v]
end
when I start as a clone
show
repeat until <(x position) > (225)>
change x by (1.6)
if <touching [Bullet v]?> then
change [score v] by (1)
delete this clone
end
end
delete this clone
Basic — the first draft 24 min
New project. Four sprites: Player, Aim, Bullet, Zombie.
Step 1 — draw quickly
Top-down is easiest: a circle with something sticking out for the player, a blob for the enemy, a small dot for the bullet, a cross for the aim. Five minutes, not fifty.
Step 2 — the aim
A forever loop with go to [mouse-pointer v] inside it, and go to [front v] layer so it is never hidden behind anything.
Step 3 — the player
The movement loop from Lesson 6, with change x by (px) and change y by (py) instead of move (10) steps. Then point towards [mouse-pointer v] at the bottom.
Step 4 — shooting
The player’s second stack, and the Bullet’s clone script.
Step 5 — the enemies
The spawner and the walker.
Step 6 — hitting
Add the touching [Bullet v]? check to the enemy, and a matching touching [Zombie v]? to the bullet so it does not fly on through.
Step 7 — play it
Two minutes without stopping. Write down anything that felt wrong.
The player spins upside down.
Add set rotation style [left-right v] at the start. Or use set rotation style [all around v] if your drawing looks fine from any angle — a top-down one usually does.
One click gives me a stream of bullets.
The wait until <not <mouse down?>> is missing, so the loop fires again the moment it comes round.
No enemies ever appear.
Either the clone never gets show, or it is spawning on the edge and deleting itself immediately. Move the spawn point inwards.
Bullets fly straight through the enemies.
They are moving too far each step and jumping right over. Use two move (7) steps blocks with the touching check between them instead of one move (14) steps.
The game gets slower and slower.
Something is not deleting its clones. Both the bullet and the enemy need a delete this clone at the end of their journey, not only when they are hit.
Move and aim
- Arrow keys move the player, with weight — it slides to a stop.
- The crosshair follows the mouse everywhere.
- The player always faces the mouse.
- The player cannot leave the Stage.
Shooting
- One click, one bullet.
- The bullet starts at the player and goes where you were aiming.
- It disappears when it leaves the Stage.
- Holding the button down does not machine-gun.
Teacher note
The seven-bullets-from-three-clicks bug is worth doing on purpose. Build it with broadcast [Fire] first, click three times, and count. Then ask why. The answer — a when I receive [Fire v] hat runs on every clone — is a rule they have known since Level 1’s Lesson 10 and have never seen bite.
Hold the line
The deck’s mission: the first playable draft.
- Enemies arrive from the left at random times and random heights.
- They walk across and disappear at the far side.
- A bullet stops one, and your score goes up.
- It can be played for two minutes without slowing down.
Teacher reveal — what to fix first
Most drafts have the same three problems, in this order of annoyance:
- Bullets pass through. The step is bigger than the enemy. Halve it and check twice.
- Nothing happens when you lose. There is no losing yet — that is next lesson, and it is fine to leave it.
- It gets slow. Clones are not being deleted. Ask them to hold down the mouse for thirty seconds and watch.
Design it properly
The deck asks you to draft your game and write the rules down before you build any more. Do that — and make it your game, not ours.
- What is the player, and what is chasing them?
- How do you lose?
- Is there a way to win, or does it go for ever?
- What gets harder as you go?
Summary 5 min
- Write the rules before the blocks. Four rules is a game.
go to [mouse-pointer v]andpoint towards [mouse-pointer v]are all an aim needs.point towards [mouse-pointer v]runs once. After that a bullet cannot be steered.- A
when I receive [Fire v]hat runs on every clone — which is why the player, not the bullet, makes the clone. - Never spawn a sprite on the edge if you are going to ask whether it is touching one.
- Aim
- A sprite that shows where you are pointing.
- Spawn
- To make a new enemy appear.
- Wave
- Enemies arriving one after another.
- Draft
- The first version that plays. Ugly is fine.
Hand in
Share your draft and send the link to your teacher, with your five rules. Next lesson the enemies fight back.