- Learnt27 min · seven effects, set or change, sliders
- Basic25 min · paint the maker
- Challenge 1–327 min · four colours, two sliders, a clean start
- Extrabonus · a mood dial
Review — where we got to 5 min
- The monster is three sprites: Head, Body and Legs.
(costume [number v])reads which costume is on.switch costume to ((costume [number v]) + (1))is the ▶ arrow.- Each part copies its number into a variable: head, body, legs.
Quick-fire
The head wears costume 4. You press ▶. What is the head’s number now?
Reveal the answer
1. There is no costume 5, so Scratch goes round to the first one. One eye again.
Today’s Topic 3 min
- The seven graphic effects
set [color v] effect to (50)andchange [color v] effect by (25)clear graphic effects- Three ways to show a variable, and the slider
- A forever loop that copies a variable into an effect
Learning outcome
By the end of this lesson you will be able to:
- Use all seven effects and say what each one does.
- Choose between set and change, and clear effects on the green flag.
- Drive an effect on every part from one slider on the Stage.
Learnt — effects as numbers 27 min
In Level 1 you changed a colour on the beat, a bit more each time. Today an effect is a number you choose. The player picks it, and the monster follows.
1 · Seven effects
Looks has two effect blocks. Each has a dropdown with seven effects in it.
| Effect | What you see | Numbers to try |
|---|---|---|
set [color v] effect to (50) | Every colour shifts round the rainbow. | 0 to 200. At 200 it is back where it started. |
set [fisheye v] effect to (100) | The middle bulges out, like a fish-eye lens. | Below 0 pinches it in instead. |
set [whirl v] effect to (150) | The middle twists round. | Below 0 twists the other way. |
set [pixelate v] effect to (60) | The sprite turns into big square blocks. | Bigger number, bigger blocks. |
set [mosaic v] effect to (25) | Lots of small copies, in a grid. | Bigger number, more copies. |
set [brightness v] effect to (50) | Lighter, towards white. | −100 is black. 100 is white. |
set [ghost v] effect to (70) | See-through. | 0 solid, 100 gone. |
The embed runs all seven, one after another. It uses clear graphic effects between each one, so you only ever see one at a time.
clear graphic effects
set [whirl v] effect to (150)
say [whirl 150]
wait (1.4) seconds
say.How to use this: Click the green flag to start it. Nothing else to press — watch it through, then use ↺ Reset to run it again.
2 · Set or change?
change [color v] effect by (25)
set [color v] effect to (50)
Change is for something that keeps moving, like lights on a beat. Set is for a colour you want to name. Our monster needs names.
| Colour number | Our monster turns |
|---|---|
| 0 | green (no change) |
| 50 | blue |
| 100 | pink |
| 150 | orange |
| 200 | green again |
These colours are for our green monster. A red sprite gets different colours from the same numbers, because the effect shifts whatever colour is there.
3 · One number for the whole monster
Three parts means three sprites to paint. Instead of telling each one, put the colour in a variable. Each part copies it into its effect, over and over.
- In Variables, make
colour, For all sprites. - On the Stage, build
when [2 v] key pressedandset [colour v] to (50). - Give each part the forever loop below.
- Press 2. All three parts turn blue together.
when flag clicked
go to x: (0) y: (65)
switch costume to [two eyes v]
forever
set [color v] effect to (colour)
end
when [2 v] key pressed
set [colour v] to (50)
How to use this: Click the green flag, then click the stage once and press 1, 2, 3 or 4 to pick a colour.
4 · A slider on the Stage
A variable’s readout on the Stage can look three ways. Right-click it to choose.
| Readout | What it shows | Good for |
|---|---|---|
| normal readout | The name and the number, small | Checking your code while you build |
| large readout | Only the number, big | A score the player should see |
| slider | The name, the number and a bar you drag | Letting the player choose the number |
- Make a second variable,
wobble, For all sprites. - Right-click the
colourreadout on the Stage. Choose slider. - Right-click it again. Choose change slider range. Type 0 and 200.
- Do the same for
wobble, with 0 and 200. - Drag a slider. The number changes. The monster does not — yet.
The slider only changes the variable. The forever loop is what copies it into the effect. Add a second line for wobble, using whirl.
when flag clicked
go to x: (0) y: (65)
switch costume to [two eyes v]
clear graphic effects
forever
set [color v] effect to (colour)
set [whirl v] effect to (wobble)
end
How to use this: Click the green flag, then click the stage once. Press → and ← to change colour, ↑ and ↓ to change wobble.
when [right arrow v] key pressed
change [colour v] by (25)
Basic — paint the maker 25 min
Open last lesson’s monster maker. You are adding to it, not starting again.
How to use this: Click the green flag. Click a part or a ◀ ▶ arrow on the stage to change a part. Click the stage once, then press → ← for colour and ↑ ↓ for wobble.
Step 1 — the two variables
- Make
colourandwobble, both For all sprites. - Turn both readouts into sliders, range 0 to 200.
- Drag them to the top-left, under head, body and legs.
Step 2 — the head’s loop
- On the Head’s green-flag stack, add
clear graphic effectsat the bottom. - Add a forever loop under it, with the two set-effect blocks inside.
- Drag the colour slider. Only the head should change.
Step 3 — body and legs
- Drag the clear block and the loop onto the Body sprite in the Sprite list. That copies them.
- Do the same onto Legs.
- Put each copy at the bottom of that part’s own green-flag stack.
- Drag the colour slider. All three should change together.
Step 4 — a clean start
- Click the Stage. Add a green-flag stack that sets colour and wobble to 0.
- Drag both sliders somewhere strange. Press the green flag.
- The sliders jump back to 0 and the monster is plain again.
when flag clicked
go to x: (0) y: (65)
switch costume to [one eye v]
set [head v] to (costume [number v])
clear graphic effects
forever
set [color v] effect to (colour)
set [whirl v] effect to (wobble)
end
when flag clicked
set [colour v] to (0)
set [wobble v] to (0)
One part will not change colour.
That part has no forever loop, or its loop is in a stack that never runs. Click the part in the Sprite list and look for the loop under its green flag.
The monster flashes every colour at once.
A change [color v] effect by (colour) is in the loop. Swap it for the set block.
The slider only goes up to 100.
100 is the starting range. Right-click the slider, choose change slider range, and set the maximum to 200.
The eyes change colour too.
White, grey and black hardly change with the colour effect. If your eyes are coloured, they will change with the rest. Draw them white with a dark middle.
Four named colours
Four keys, four colours for the whole monster.
- 1 green, 2 blue, 3 pink, 4 orange.
- All three parts change together.
- Pressing the same key again changes nothing.
Two sliders
The player dials in the monster themselves.
- A colour slider from 0 to 200.
- A wobble slider that twists the monster.
- Both sliders move every part at once.
Teacher note
The classic slip is a loop on the Head only. It is worth letting a pupil find it by dragging, rather than warning them.
A third dial, and a clean start
Add one more slider of your choice, and make the green flag undo everything.
- A third slider drives fisheye, pixelate or brightness.
- The green flag puts all three sliders back to 0.
- The green flag clears every effect on every part.
Teacher reveal — a fisheye dial on the Body
when flag clicked
go to x: (0) y: (-25)
switch costume to [round v]
set [body v] to (costume [number v])
clear graphic effects
forever
set [color v] effect to (colour)
set [whirl v] effect to (wobble)
set [fisheye v] effect to (fisheye)
end
Plus set [fisheye v] to (0) on the Stage’s green flag. A brightness dial wants a range of −100 to 100; ask the pupil why before they find out.
A mood dial
One slider called mood, from 1 to 3. Each mood is a mix of effects, and the monster shows it.
- Mood 1, happy: no effects at all.
- Mood 2, cold: blue and a bit see-through.
- Mood 3, cross: red and puffed up.
How to use this: Click the green flag, then click the stage once and press 1, 2 or 3 to set the mood.
Teacher reveal — one part’s mood loop
when flag clicked
go to x: (0) y: (65)
switch costume to [four eyes v]
forever
clear graphic effects
if <(mood) = (2)> then
set [color v] effect to (50)
set [ghost v] effect to (40)
end
if <(mood) = (3)> then
set [color v] effect to (133)
set [fisheye v] effect to (60)
end
end
Clearing inside the loop does not flicker: the whole pass runs before the Stage is drawn. Colour 133 is red on our green monster.
Summary 5 min
- Looks has seven graphic effects, and each one is a number.
setgoes to a number.changeadds to it. Named colours need set.clear graphic effectsbelongs under every green flag that uses an effect.- A slider lets the player choose a variable’s value.
- A forever loop copies the variable into the effect, on every part.
- Graphic effect
- A change to how a sprite looks, without changing its costume.
- Slider
- A readout with a bar the player drags to set the variable.
- Range
- The smallest and biggest numbers a slider can reach.
- Readout
- A variable shown on the Stage. Scratch also calls it a monitor.
Hand in
Save your maker and share the link with your teacher. Next lesson the monster dances.