Computer Coding Projects For Kids - A Step-by-Step Visual Guide To Creating Your Own Scratch Projects PDF
Computer Coding Projects For Kids - A Step-by-Step Visual Guide To Creating Your Own Scratch Projects PDF
P FO R K I D S
rojects
computer coding
P F O R K I D S
jon woodcock
foreword by carol vorderman
DK UK
Senior editor Ben Morgan
Senior art editor Jacqui Swan
Jacket design development manager Sophia MTT
Jacket editor Claire Gell
Producer, pre-production Gillian Reid
Producer Mary Slater
Managing editor Lisa Gillespie
Managing art editor Owen Peyton Jones
Publisher Andrew Macintyre
Associate publishing director Liz Wheeler
Art director Karen Self
Design director Phil Ormerod
Publishing director Jonathan Metcalf
DK DELHI
Project editor Suefa Lee
Project art editor Parul Gambhir
Editor Sonia Yooshing
Art editor Sanjay Chauhan
Assistant art editor Sonakshi Singh
Jacket designer Suhita Dharamjit
Managing jackets editor Saloni Singh
DTP designer Jaypal Chauhan
Senior managing editor Rohan Sinha
Managing art editor Sudakshina Basu
Pre-production manager Balwant Singh
Printed in China
A WORLD OF IDEAS:
SEE ALL THERE IS TO KNOW
www.dk.com
Carol Vorderman ma (Cantab), mbe, is one of Britain’s best-loved TV
presenters and is renowned for her skills in mathematics. She has a degree in
engineering from the University of Cambridge. Carol has a keen interest in coding
and feels strongly that every child should have the chance to learn such a valuable
skill. She has hosted numerous TV shows on science and technology, such as
Tomorrow’s World and How 2, on the BBC, ITV, and Channel 4. Whether co-hosting
Channel 4’s Countdown for 26 years, becoming the second-best-selling female
non-fiction author of the noughties in the UK, or advising Prime Minister David
Cameron on mathematics education in British schools, Carol has a passion and
devotion to explaining mathematics, science, and technology in an exciting
and easily understandable way.
dr Jon WoodCoCK ma (oXon) has a degree in physics from the University of Oxford
and a PhD in computational astrophysics from the University of London. He started
coding at the age of eight and has programmed all kinds of computers, from single-chip
microcontrollers to world-class supercomputers. His many projects include giant space
simulations, research in high-tech companies, and intelligent robots made from junk.
Jon has a passion for science and technology education, giving talks on space and
running computer programming clubs in schools. He has worked on many science
and technology books, and is the author of DK’s Computer Coding for Kids, Computer
Coding Games for Kids, and DK’s series of coding workbooks.
Contents
8 foreword
12 Creative computers
82 Birthday Card
14 Programming languages
94 Spiralizer
16 How Scratch works
106 Fantastic Flowers
18 Getting Scratch
20 The Scratch interface
22 Types of project
In recent years, interest in coding has exploded. All over the world, schools
are adding coding to their curriculums, code clubs are being launched to
teach beginners, and adults are returning to college to learn coding skills
now considered vital in the workplace. And in homes everywhere, millions
of people are learning how to code just for the fun of it.
Fortunately, there’s never been a better time to learn how to code. In the
past, programmers had to type out every line of code by hand, using obscure
commands and mathematical symbols. A single full stop out of place could
ruin everything. Today, you can build amazingly powerful programs in
minutes by using drag-and-drop coding languages like Scratch™, which is
used in this book.
As learning to code has become easier, more people have discovered the
creative potential of computers, and that’s where this book comes in. Computer
Coding Projects for Kids is all about using code for creative purposes – to make
art, music, animation, and special effects. With a little bit of imagination
you can produce dazzling results, from glittering firework displays to
kaleidoscope-like masterpieces that swirl and beat in time to music.
If you’re completely new to coding, don’t worry – the first two chapters
will walk you through the basics and teach you everything you need to
know to use Scratch. The later chapters then build on your skills, showing
you how to create interactive artworks, life-like simulations, mind-bending
optical illusions, and some great games.
Learning something new can sometimes feel like hard work, but I believe
you learn faster when you’re having fun. This book is based on that idea,
so we’ve tried to make it as much fun as possible. We hope you enjoy
building the projects in this book as much as we enjoyed making them.
Carol Vorderman
On your marks...
get set... CODE!
What is
coding?
12 w h at i s c o d i n g ?
Creative computers
Computers are everywhere and are used in all sorts of
creative ways. But to really join in the fun, you need to
take control of your computer and learn how to program it.
Programming puts a world of possibilities at your fingertips.
▷ A simple recipe
Imagine you want a friend to bake a cake, but your
Easy peasy!
friend has no idea how to cook. You can’t simply give
them an instruction like “make a cake” – they won’t
know where to start. Instead, you need to write a
recipe, with simple steps like “break an egg”, “add
the sugar”, and so on. Programming a computer Recipe
is a bit like writing a recipe.
Recipe
Ingredients
2. Seven colours
◁ Step by step Instructions
Now imagine you want to 1. Clear the screen to create a white background.
program a computer to create
2. Repeat the following ten times:
a painting like the one shown
here, with coloured circles a) Pick a random place on the screen.
overlapping each other at b) Pick one of the circles randomly.
random. You have to turn the c) Pick one of the colours randomly.
job of painting the picture into
d) Draw a see-through copy of the circle
a kind of recipe, with steps the at that place in that colour.
computer can follow. It might
look something like this:
c r e at i v e c o m p u t e r s 13
▷ Computer language
Although you can understand the recipe when clicked
for a painting or a cake, a computer can’t.
forever
You need to translate the instructions into
move 10 steps
a special language that the computer can
understand – a programming language.
The one used in this book is called Scratch.
Worlds of imagination
There isn’t a single creative field in the world that hasn’t been touched
by computers. In this book, you’ll get to make lots of great projects that
will fire your imagination and make you think and code creatively.
Building games programs is just as much fun as Special effects and dramatic scenery in films
playing them, especially when you make all the rules. are often created in graphics programs.
14 W H AT I S C O D I N G ?
Programming languages
To tell a computer what to do, you need to speak the right
kind of language: a programming language. There are lots
to choose from, ranging from easy ones for beginners, like
the one in this book, to complex languages that take years
to master. A set of instructions written in any programming
language is called a program.
scratch
Popular languages
There are more than 500 different
Hello!
programming languages, but most programs
are written in just a handful of these. The
most popular languages use English words,
but lines of code look very different from
English sentences. Here’s how to get a
computer to say “Hello!” on screen in
just a few of today’s languages.
▷C
The C programming language #include <stdio.h>
is often used for code that main(){ printf(“Hello!”); } Hello!
runs directly on a computer’s
hardware, such as the Windows
operating system. C is good for
building software that needs to
run fast and has been used
to program space probes.
#include <iostream>
▷ C++ int main()
This complicated language is used {
to build large, commercial programs std::cout << “Hello!” << std::endl;
such as word processors, web }
browsers, and operating systems.
C++ is based on C, but with extra
features that make it better for
big projects.
PROGRAMMING LANGUAGES 15
class HelloApp {
when clicked public static void main(String[] args) {
say Hello! System.out.println(“Hello!”);
}
}
△ Scratch
Beginners often start with simple programming
languages such as Scratch. Instead of typing out △ Java
code, you build scripts with ready-made coding blocks. Java code is designed to work on all types
of devices, from mobile phones and laptops
to games consoles and supercomputers.
Minecraft is written in Java.
print(“Hello!”)
lingo
Code words
Algorithm A set of instructions that
are followed to perform a particular
task. Computer programs are based
on algorithms.
△ Python Bug A mistake in a program. They are
Python is a very popular, all-purpose language. called bugs because the first computers
The lines of code are shorter and simpler than had problems when insects got stuck in
in other languages, making it easier to learn. their circuits.
Python is a great language to learn after Scratch.
Code Computer instructions written in
a programming language are often called
code. Coding is programming.
alert(‘Hello’);
△ JavaScript
Programmers use JavaScript to create
interactive features that run on websites,
such as advertisements and games.
16 w h at i s c o d i n g ?
Sprites
Sprites are the objects shown on the screen. Scratch comes with
a huge selection of sprites – such as elephants, bananas, and
balloons – but you can also draw your own. Sprites can perform all
sorts of actions, like moving, changing colour, and spinning round.
I’m a sprite!
wait 1 secs
wait 1 secs
Online Offline
Visit the Scratch website at http:// Visit the Scratch website at http://
scratch.mit.edu and click on “Join scratch.mit.edu/scratch2download/
Scratch” to create an account with and follow the instructions to download
a username and password. You’ll and install Scratch on your computer.
need an email address too.
Online Scratch runs in your web browser, Scratch will appear as an icon on
so just go to the Scratch website and your desktop, just like any other
click on “Create” at the top of the screen. installed program. Double-click on
The Scratch interface will open. the Scratch cat icon to get going.
You don’t have to worry about saving You’ll need to save your project by
your work as the online version of clicking on the File menu and selecting
Scratch saves projects automatically. “Save”. Scratch will ask you where
to save your work – check with the
computer’s owner.
when clicked
forever
move 10 steps
go to mouse-pointer ▾
turn 15 degrees
point in direction 90 ▾
point towards ▾
go to x: 0 y: 0
go to mouse-pointer ▾
glide 1 secs to x: 0 y: 0
Motion Events
Looks Control
when clicked
Sound Sensing hide
x: -126
y: 96
Pen Operators repeat 300
move 10 steps
◁ Scratch 2.0
turn 15 degrees
go to Rocket ▾
point towards ▾
go to x: 0 y: 0
point in direction
show
pick random –180 to 180 are many more blocks and features than
x: 153 y: -61
go to mouse pointer ▾
repeat 50
Stage hide
1 backdrop
New backdrop:
Rocket Stars
can save scripts, sprites, and other
Backpack
useful things.
ExpErt tips
Mouse-pointers
Scratch needs some accurate something with your computer
mouse-work, which is easier to mouse. If your mouse only has
do with a computer mouse than one button, you can hold down
a touchpad. In this book, you’ll the shift or control key on your
often be instructed to right-click keyboard as you click.
20 w h at i s c o d i n g ?
interface
This is Scratch mission control. SCRATCH File ▾ Edit ▾ Tips ?
The Stage
This is where the action
happens. When you run your
project, the stage is where all
the sprites appear, moving
and interacting as they
follow their scripts.
x: 153 y: -61
Stage
SPrIteS 1 backdrop Dinosaur1 Dinosaur2 Dinosaur3 Ballerina
lISt New backdrop:
S ta g e I n f o B a C K Pa C K
Scripts area
Use the Drag blocks into this part of the
Select the Costumes tab Use the Sounds tab to Scratch window and join them
Scripts tab to to change how add music and sound together to build scripts for each
build scripts. sprites look. effects to sprites. sprite in your project.
Motion Events
Looks Control Click these headings Selected
to reveal different sprite
x: 20
Sound Sensing sets of blocks. y: –100
Pen Operators
Data More Blocks
when clicked
forever
move 10 steps
repeat 3
Backpack
Types of project
This book has a wide range of fun Scratch projects. Don’t
worry if you haven’t used Scratch before or you’re not an
expert – the “Getting started” chapter is there to help
you. Here’s a handy guide to the projects in this book.
48 g e t t i n g s ta r t e d animal race 49
60 g e t t i n g s ta r t e d ask gobo 61
◁ Variables
The cat’s script stores
Cat Art (p.26) Dino Dance Party (p.34) Animal Race (p.48) Ask Gobo (p.60)
information in something
3 programmers call a variable.
In this project, you’ll use
a variable to store the The dog runs for
numbers for the cat’s count the finish – one stride
at the start of the race. The cross and arrow every time you press
Count mark the start line. the “m” key.
△ Getting started
Work your way through these easy projects to learn how to
use Scratch. Each project introduces important new ideas, so
don’t skip any if you’re a beginner. By the end of the chapter,
you’ll have mastered the basics of Scratch.
94 a
arrt
t s
spp ii r
raal
l ii z
zeer
r 95 Funny Faces (p.70)
t Spiralizer b i r t h d ay c a r d 83
Try
Try out
out this
this spinning
spinning spiral
spiral project.
project.
day Card
Click
Click the
the icon
icon to The
to The
The clones’
clones’ different
different The ball
ball in
in the
the centre
centre
Be sure to run this project
Change
Change the
A balloon-filled backdrop the patterns
patterns using
The animatedusing
special
special
sign at the
make
make the
fill
the spiral
spiral directions
directions make
make is
is the
the original
original sprite;
sprite;
fill your
your screen.
screen. them
them form
form aa spiral. all
all the
the others
others are
are clones.
in full-screen mode. sets the scene. sliders
sliders to
to alter
altertopthe
rocksvalues
the values of variables
ofside.
from side to variables spiral. clones.
n ordinary birthday in
in the
the code.
code. You
You control
control the the artart –– the
the Spiralizer
ou can have an Birthday Card possibilities
possibilities are
are endless!
endless! Spiralizer
by SpiralAttack (unshared)
by SpiralAttack (unshared)
ast for the eyes and by PartyPlanner120 (unshared)
◁ Art
Y!
BIRTHDA
ging sharks, but you How
How it
it works
works Speed
Speed 22 △ Clones
△ Clones
Clones
e project to make Clones are
are working
working copies
copies
This
This simple
simple project
project has
has only
only one
one sprite:
sprite: aa of
of sprites.
sprites. When
When aa clone
clone isis
HAPPY
coloured created,
created, it
it appears
appears on
on top
coloured ball,
ball, which
which stays
stays in
in the
the middle.
middle. This project uses the “glide” of
top
Scratch’s of the
the existing
existing sprite
sprite and
and
Scratch’s clone
clone blocks
blocks make
make copies
copies of
of the
the block, which makes sprites has
has the
the same
same properties,
properties,
ball
ball that
that move
move outwards
outwards in in straight
straight lines.
lines. move smoothly around such
such as
as direction,
direction, size,
size,
the stage. You need to use
rks A
A spiral
spiral pattern
pattern forms
forms because
because each
each clone
clone Scratch’s coordinates system
and
and so
so on.
on.
moves
moves inin aa slightly
slightly different
different direction,
direction, like
Window Cleaner
Each
Each line
line is
is drawn
drawn using
(unshared)
Scratch’s
Scratch’s built-in
which
which lets
lets any
any sprite
using
built-in pen,
pen,
sprite draw.
draw.
△ Scratch
△ Scratch pen pen Slime tim
Slime tim
LY ON YOUR BIRTHDAY! Every
Every sprite
sprite can
can draw
draw aa
To make som
How
How it
it works
works
with flowers.
The game starts by cloning a splat sprite and scattering ▽ Splat sprite
The game starts by cloning a splat sprite and scattering ▽ Splat sprite
22
This game has one sprite The pain
clones with different costumes randomly across the stage. This game has one sprite The pain
clones with different costumes randomly across the stage. with several costumes, make yo
make yo
When motion is detected by the webcam, Scratch uses with several costumes, a colour
When motion is detected by the webcam, Scratch uses which you’ll paint yourself. a colour
122 123 its “ghost” effect to make the splats fade. If you wave your which you’ll paint yourself.
By cloning the sprite you
122 games
games
tunnel of doom
tunnel of doom 123 its “ghost” effect to make the splats fade. If you wave your By cloning the sprite you
hand enough, they eventually disappear. The aim of the can cover the screen with
hand enough, they eventually disappear. The aim of the can cover the screen with
Tunnel of Doom Do you dare
Do you dare
to enter the
to enter the
“Tunnel of Doom”?
game is to remove as many splats as you can in one minute.
game is to remove as many splats as you can in one minute.
splats of messy gunk.
splats of messy gunk.
Scratch is
Scratch is the
the ideal
ideal playground
playground forfor making
making and
and Will your time “Tunnel of Doom”?
Will your time
perfecting games.
games. To
To win
win at
at this
this game,
game, you
you need
need The cat starts here. Time in seconds be the fastest?
perfecting
33 Select th
The cat starts here. Time in seconds be the fastest?
a steady
a steady hand
hand and
and nerves
nerves of
of steel.
steel. Take
Take the
the cat
cat Select th
and dra
all the
all the way
way through
through the
the Tunnel
Tunnel ofof Doom,
Doom, but
but and dra
Tunnel of Doom Window Cleaner of a larg
don’t
don’t touch
touch the
the walls!
walls! For
For an
an extra
extra challenge,
challenge, Tunnel of Doom
by DirtDigger465 (unshared) Window Cleaner of a larg
by PaintChampion (unshared) whole p
▷ Games
try to
try to beat
beat the
the best
best time.
time. by DirtDigger465 (unshared)
by PaintChampion (unshared) whole p
Time
Time
201
201 will get
Score 42 will get
Best time
Best time
245
245 Score 42
How it
How it works
works Reach home to
Reach home to
win the game. Countdown 8
Use your mouse
mouse toto move
move thethe cat
cat all
all the
the way
way through
through
win the game. Countdown 8
Use your
Drumtastic
190 music and sound Dancing cat
To make the project more fun, the cat will dance and
d r u m ta s t i c 191
A,B,C,D...
chapter shows you how to simulate falling snow, sparkling background symbol
to in the each variable.
When you run the project, the Scratch cat asks you to into a drum sound. There are lower Stage
a solid colour by left of Scratch,
▽ Scratch26 drumkit
letters in the alphabet but
How it works
type something in the box. When you press return, the Scratch
The script turns onlyletter
every has 18 drum
clicking thepicking
paint a cool 2 backdrops Click here to make
Make a Variable
each variable.
Click here.
The words The drums light up Click “OK” to Choose this option.
◁ Mindbenders
Making images move in clever ways can fool
the eye into seeing amazing patterns and
optical illusions. Try these mindbending,
spinning-pattern projects.
exPert tiPs
Perfect projects
Every project in this book is do, go back a few steps and check
broken down into easy steps – the instructions again carefully.
read each step carefully and you’ll If you still have problems, ask
sail through them all. The projects an adult to check with you. Once
tend to get more complicated you’ve got a project working,
later in the book. If you find a don’t be afraid to change the
project isn’t doing what it should code and try out your own ideas.
Getting
started
26 g e t t i n g s ta r t e d
How it works
This simple project lets you use a
computer mouse to paint multicoloured
cat art. Wherever you drag the mouse, a
rainbow trail of cats is left behind. Later
on you’ll see how to add other effects.
◁ Artistic cat
This project lets you go wild
with your imagination. You
can experiment with a variety
of colours, sizes, and effects
for the cat, and in the end
your project will look like
a piece of modern art.
Mouse control
The first step is to make the cat sprite move wherever
the mouse-pointer moves. You need to build a set of Follow me.
Motion Events
Looks Control
The cat sprite on the Sound Sensing x: -126
y: 96
stage is the only item Pen
Data
Operators
More Blocks
in a new project.
move 10 steps
turn 15 degrees
turn 15 degrees
when clicked
point in direction 90 ▾
forever
point towards ▾
go to mouse-pointer ▾
go to x: 0 y: 0
change x by 10
set x for 0
Stage
1 backdrop Sprite1
change y by 10
New backdrop:
Backpack
forever
Stops scripts
Starts scripts
Multicoloured cats
Scratch is packed full of ways to make
art. The simple script changes here will
send your cat straight to the art gallery.
go to mouse-pointer ▾
go to mouse-pointer ▾
12 You’ll find that the stage soon fills up with cats, but
don’t worry, as you can add a script to wipe it clean when space ▾ key pressed
at the press of a button. Choose Pen in the blocks
palette and look for the “clear” block. Drag it into clear
the scripts area but keep it separate from the first
script. Then click on Events and add a brown “when
space key pressed” block. Run the project and see This header block starts the
what happens when you press the space-bar. script when the chosen key is
pressed on the keyboard.
ExpErt tips
Full screen
To see projects at their
best, you can simply click
the full-screen button just
above the stage to hide
the scripts and just show
the results. There’s a similar
button to shrink the stage
and reveal the scripts again
from full-screen mode.
Click here to
If you use the offline
see your project
version of Scratch, don’t
fill the screen.
forget to save your work
from time to time.
32 g e t t i n g s ta r t e d
▽ Smooth changes
Don’t be afraid to experiment with the numbers and settings
in Scratch commands. You don’t have to change the cat’s
when clicked
colour effect by 25 each time. The lower the number, the
more slowly the colour will change, like in this rainbow. forever
go to mouse-pointer ▾
stamp
ExpErt tips
Scratch's ghost effect Script runs from The “forever” block makes
makes sprites transparent. top to bottom. the program return to the
start of the loop.
when clicked
forever
when left arrow ▾ key pressed
change colour ▾ effect by 25
change ghost ▾ effect by –1
34 g e t t i n g s ta r t e d
How it works
Each sprite has one or more scripts
that program its dance moves. Some
simply turn from side to side, but
others glide across the dance floor
or perform more varied moves. You
can add as many dancers as you like.
◁ Dinosaur
After you’ve created a dancing
dinosaur, you can duplicate
this sprite to make a group of
dinosaurs dancing in rhythm.
The “spotlight-stage”
backdrop sets the scene
for the dance party.
◁ Ballerina
To add a touch of class, the
ballerina will perform a more
complicated dance routine.
dino dance party 35
By switching between
different poses, the
sprites appear to dance.
Let’s party!
36 g e t t i n g s ta r t e d
Dancing dinosaur
Scratch has lots of ready-made sprites for your project in the
sprite library. Many of the sprites have several “costumes”,
each showing the sprite in a different pose. If you make
a sprite switch costumes quickly, it looks like it’s moving.
New
?
Revert
duplicate
delete
Dinosaur1
save to local file
dino dance party 37
5 Look at the dinosaur on the stage and press the space-bar. Every time
you press it, the dinosaur will change its pose. It’s still the Dinosaur1
Each pose is a different
costume belonging to
sprite, but the way it looks keeps changing. Each different pose is called the dinosaur sprite.
a costume and can be used to make a sprite appear to do different things.
2
Each costume has a
different name.
dinosaur1-b
233x158
Vector Mode
Convert to bitmap
dinosaur1-d
95x172
38 g e t t i n g s ta r t e d
Dance steps
By using loops you can make the dinosaur change
its costume repeatedly, making it appear to move.
Changing pictures quickly to give the illusion of
movement is called animation.
when clicked
forever
Remember, blocks are
next costume colour-coded. The “forever”
loop is in the yellow
Control blocks section.
dinosaur1-c dinosaur1-d
Choose
“dinosaur1-d”.
dino dance party 39
The “spotlight-stage”
Stage backdrop sets the
1 backdrop Dinosaur1 mood of the party.
New backdrop:
15 Add this script to make the disco lights flash. This block only
Then click the green flag to run the project – changes the backdrop
when clicked colours. It does not
it should look like a real disco. You can
affect the other sprites.
experiment with the time in the “wait”
forever
block to make the lights flash faster or
slower if you want. change colour ▾ effect by 25
Dinosaur1 Dinosaur2
if on edge, bounce
Add this block to turn
Dinosaur2
the dinosaur round at
the stage’s edge.
Dinosaur2
x: –5 y: 18 direction: -90°
rotation style:
can drag in player:
show:
42 g e t t i n g s ta r t e d
Keyboard control
Ever dreamed of taking control of your very own
dinosaur? The next script will give you keyboard
control of Dinosaur3’s movements: you’ll be able
to move the dinosaur across the stage with the
right and left arrow keys.
complicated, so make
sure you get everything forever key right arrow ▾ pressed?
in the right place. The
“if then” block is in if then
the yellow Control Drag this pale blue Sensing
block into the window in
blocks section. It’s point in direction 90 ▾ the yellow block.
a special block that
chooses whether or move 10 steps Choose 90 here. This points
not to run the blocks the sprite to the right.
inside it by asking a
question. Take care to
ensure that both “if if key left arrow ▾ pressed? then
then” blocks are inside
the “forever” loop and point in direction –90 ▾ Click here and choose
not inside each other. “left arrow”.
move 10 steps
25 Before you run the script, read through it carefully and see
if you can understand how it works. If the right arrow key
is pressed, blocks that make the sprite point right and move
are run. If the left arrow key is pressed, blocks that make
the sprite point left and move are run. If neither is pressed,
no blocks are run and the dinosaur stays put. Repeat
step 22 to stop Dinosaur3 from turning upside down.
dino dance party 43
ExpErt tips
Making choices
You make choices all the time. If you’re hungry, you
decide to eat; if not, you don’t. Computer programs
can also make choices between different options.
One way to make them do this is to use an “if then”
instruction, which is used in lots of programming Is the right
arrow key Move right
languages. In Scratch, the “if then” block includes
pressed? Yes
a statement or a question and only runs the code (true)
inside the block if the statement is true (or the
answer is yes).
No
(false)
Add a ballerina
The dinosaurs are dancing, but it’s not much of a party
without some friends. A ballerina is going to join the fun
and will do a routine. Her scripts will show you how to
create more complicated dance routines.
26 Click on the sprite symbol in the sprites list and load the
ballerina. Then use your mouse to drag the sprite to a good
spot on the stage. To give the ballerina some scripts, make
sure she’s selected in the sprites list – the selected sprite
has a blue outline. Scripts Costumes Sounds
Ballerina
ballerina-a
61x10
lingo
Algorithms
An algorithm is a series ALGORITHM PROGRAM
of simple, step-by-step (Dance steps) (Dance steps turned into computer
instructions that together programming language)
carry out a particular task.
In this project, we converted
STAND!
the ballerina’s dance routine
(an algorithm) into a WAIT! switch costume to ballerina-a ▾
program. Every computer
program has an algorithm wait 0.5 secs
at its heart. Programming is
KICK! switch costume to ballerina-d ▾
translating the steps of the
algorithm into a computer wait 0.5 secs
WAIT!
programming language that
the computer understands. switch costume to ballerina-a ▾
STAND! wait 0.5 secs
BEND
THE KNEES!
dino dance party 45
ExpErt tips
repeat loops and forever loops
Look at the bottom of the two types of forever repeat 10
loop you’ve used so far. Which one can
have blocks attached to it? You might
spot that the “repeat” block has a small
lug on the bottom, but the “forever” block
doesn’t. There’s no lug on a “forever” loop
because it goes on forever, so there’s no
point adding blocks after it. A “repeat”
block, however, runs a fixed number A lug allows you to
of times and the script then continues. join new blocks.
forever
Animal Race
Have you ever wondered which is
faster – a dog or a bat? Now you Animal Race
by TopDog763 (unshared)
can find out when you play this
fun fast-finger, button-pressing,
two-player animal race game. Go!
How it works
The aim of this two-player game is simply
to race across the screen and reach the
balloons before the other player. Fast
finger action is all you need to win.
The faster you tap the keyboard’s “z”
or “m” key, the faster your sprite moves
from left to right.
◁ Sending messages
This project shows you how
to use Scratch’s message
feature to make one sprite
pass information to other
sprites, such as when the
cat sprite tells the dog
and bat to start racing.
◁ Variables
The cat’s script stores
information in something
3 programmers call a variable.
In this project, you’ll use
a variable to store the
numbers for the cat’s count
at the start of the race. The cross and arrow
Count mark the start line.
animal race 49
The bat flaps its wings
every time you press
the “z” key.
Balloons mark
the finish area.
Catch me
if you can!
Sound Sensing
Pen Operators
OK Cancel
Data More Blocks
Enter
Make a Variable “Count” here.
Make a List
Click here.
4 Make this script for the cat. It starts by setting the
value of “Count” to zero. Next, inside a loop, it adds
one to the value of “Count” and makes the cat say
the new value for one second. The loop runs three
3 You’ll now see some orange blocks for the
new variable in the blocks palette. Uncheck times and then the cat says “Go!” to start the race.
the variable’s tick box so that it doesn’t
appear on the stage.
Setting up the racers 8 Make sure Dog2 is selected in the sprites list.
Click on the Costumes tab at the top of the
The cat is ready to start the race. The next steps blocks palette and you’ll see it has three
are to decorate the stage for the race and then to costumes. The first two show the dog running,
add the bat and the dog sprites, along with other but we don’t need the third one so delete it.
sprites to mark the start and end of the racetrack.
New costume:
dog2-a
Click here to open 127x110
the backdrop library.
2
7
It’s time to add some sprites for the racers,
starting with the dog. Click the sprite
symbol in the sprites list. Find Dog2
in the library and add it to your project. dog2-b
127x104 Click here to delete
the third costume.
Sprites 3
Choose “Dog
Start” from the
drop-down menu.
when clicked
go to Dog Start ▾
Button5 Type the new name
for the sprite here. go to front
Remember to choose
the yellow balloon
for the dog.
bat1-a
115x125
bat1-b
101x103
54 g e t t i n g s ta r t e d
when clicked
go to Bat Start ▾
go to front
The race
The bat and the dog both need scripts to make them Go!
race. The cat will trigger these scripts by sending a
message when it says “Go!” at the start of the race.
Both contestants will receive the message at exactly
the same time.
say Go!
when clicked
broadcast message1 ▾
set Count ▾ to 0
message1
repeat 3 Open the drop-down
menu by clicking here.
new message...
change Count ▾ by 1
New Message
say Go!
Message name: Start Race
Add this block to the
bottom of the script.
OK Cancel
broadcast message1 ▾
animal race 55
18 Now the cat sends out the “Start Race” message at the start of
the race. Each racer needs a script to make it react, so select
the dog first and add this script. See how the two “wait until”
blocks together make the player press the “m” key and then
release it again and again to move their character; just
keeping your finger on the “m” key won’t work.
move 10 steps This block checks if the Look for this block
Dog2 sprite is touching in the light green
next costume the “Dog Finish” balloon. Operators section.
stop all ▾
I won!
lingo
Boolean operator: noT
The “not” block reverses the answers to yes/no questions
answer to the question block (or true/false statements) in
inside it. This block is very useful useful ways: “not”, “or”, and “and”.
for testing if something isn’t Programmers call these “Boolean
happening. There are three green operators” and you’ll use all of
Operators blocks that can change them in this book.
56 g e t t i n g s ta r t e d
19 Run the project. Once the cat says “Go!”, you should find
that the dog runs forward a step each time you press and m... m... m...
release the “m” key. When it reaches its balloon, the dog
should stop responding. If anything isn’t working, carefully
check your script against the version in the book.
20 Next, add this similar script to the bat sprite. The only
differences are that the key selected now is the “z” key
and the bat must touch its own finish sprite.
move 10 steps
The bat stops running when
next costume it touches the balloon sprite.
stop all ▾
Change 0 to 4. ◁ Countdown
set Count ▾ to 4 Try changing the middle part of the cat’s
script to look like this. Can you work out
repeat 3 Place a minus what will happen now?
sign in front of 1.
change Count ▾ by –1
◁ Extra competitors
Why not add more animals to the race? Find some sprites
in the sprite library with costumes you can animate, like the
parrots or Butterfly1. Add start and end sprites for each one
of them and adapt the racing script to use different keys. If
you need to adjust a sprite’s size, just add a “set size” block.
58 g e t t i n g s ta r t e d
▽ Challenging controls
You can make the game harder for the players
by making them press two keys alternately FASTER, FASTER, KEEP
rather than one key repeatedly. You just need GOING STRAIGHT!
to change the script to wait for a second key
to be pressed and released after the first one.
This shows how to change the dog’s script.
For the bat, make the same change but
use “x” for the second key instead of “n”.
forever
move 10 steps
next costume
stop all ▾
move 10 steps
next costume
think Position
Add these
two blocks.
1
change Position ▾ by 1
Choose “this script” in
stop this script ▾ the drop-down menu.
60 g e t t i n g s ta r t e d
Ask Gobo
Do you have a tricky decision to make
Name of the project.
or want to predict the future? Let Gobo
help you in this fortune-telling project.
Here you’ll learn about random numbers,
Ask Gobo
variables, and how computer programs by FortuneTeller100 (unshared)
make choices.
How it works
Gobo invites you to ask a question and
then answers with either “Yes” or “No”.
You can ask anything you like, from “Am
I going to be a billionaire?” to “Should I
play a computer game instead of doing
my homework?” Gobo pauses to look
like it’s thinking, but its answers are
actually pure chance.
◁ Gobo
Friendly Gobo is the only
sprite in this project. It has
three costumes that you
can use later to help bring
it to life.
◁ Take a chance
Just as the roll of the dice
creates random numbers,
Scratch can generate
random numbers to
make the program react
in unpredictable ways.
ask gobo 61
◁ Ask a question!
Gobo works best if you ask
it to make predictions or
decisions for you. Don’t ask
factual questions as it’ll often
get the answer wrong!
Ask Gobo
by FortuneTeller100 (unshared)
info
duplicate
delete
set size to 250 % say Wait! The answer is coming to me... for 3 secs
New Variable
Yes! No!
Variable name: ReplyNumber
OK Cancel
ReplyNumber = 1 ReplyNumber = 2
Type the variable’s
name here.
Make a List
Click here.
64 g e t t i n g s ta r t e d
ExpErt tips
random numbers
A random number is one that you can’t
predict before it appears. A dice roll is a
random number – any of the numbers 4
1 Lowest number If you click on the
from one to six could appear each time
it can select block it will tell
you roll the dice. You don’t know which you its value. It
number will come up until you roll. In selects a random
pick random 1 to 6
Scratch, you can get a random number number each time.
using the “pick random” block. Drag
this block into the scripts area and Highest number 6
experiment with it. it can select 3
10 The variable will hold the number of Gobo’s reply, but the
program needs a way to choose that number randomly. Add a 1
“set ReplyNumber to” block to the bottom of Gobo’s script and
2
then drag a green “pick random” block into it from the Operators
section. Change the second number to two. The green block
picks randomly between one and two, like flipping a coin.
pick random 1 to 2
13 The script should now look like this. Run the project a
few times and check that Gobo gives random “yes” and
“no” answers. If not, check the whole script carefully.
Wait! The answer
is coming to me...
when clicked
wait 1 secs
if ReplyNumber = 1 then
say Yes!
if ReplyNumber = 2 then
say No!
ReplyNumber
Uncheck
the tick box.
66 g e t t i n g s ta r t e d
Am I a brilliant
programmer?
Should I be nicer
Should I do my to my sister?
homework right away?
ExpErt tips
More decisions
You’ve already seen how to use “if then” blocks There are three different green blocks you
containing questions to decide whether or can use to compare numbers, each with
not to run lines of code. In this project, you a different job and symbol: = (equal to),
use green Operators blocks inside “if then” > (greater than), and < (less than). Programmers
blocks to check the value of a variable. The call true-or-false decisions used inside “if then”
pale blue question blocks have “yes” or “no” blocks “Boolean conditions”. They are named
answers, but when you use the green blocks after the English mathematician George Boole
you should ask if what they say is true or false. (1815–1864).
▽ Ask me another say I can answer your yes-or-no questions. for 3 secs
To make Gobo answer more questions after the say Ask your question then press space.
first one, place the original script inside a “forever”
wait until key space ▾ pressed?
loop, as shown here, with a few extra blocks to
make Gobo prompt the user for a new question. say Wait! The answer is coming to me... for 3 secs
wait 1 secs
say Yes!
when clicked
forever if then
ReplyNumber = 2
say No!
wait 3 secs
▷ Special effects
You can alter Gobo’s replies to be more
fun. While you’re at it, why not make if ReplyNumber = 2 then
Gobo change colour or costume for each
reply? You could also add sounds to its say How DARE you ask that!
replies, some dance steps, or a spin.
switch costume to gobo-c ▾
▽ More replies
To add to the fun you can extend the number of replies. You simply need
to increase the top number in the “pick random” block to the new number
of choices and then add extra “if then” blocks containing new “say” blocks. Change the 2 into a 6. This must
This example has six possible answers, but you can add as many as you like. match your number of replies or
some responses will never appear.
Yes!
if ReplyNumber = 1 then
say Yes!
if ReplyNumber = 2 then
No!
say No!
if ReplyNumber = 3 then
if ReplyNumber = 4 then
Definitely!
say Definitely!
if ReplyNumber = 5 then
if ReplyNumber = 6 then
when clicked
wait 1 secs
wait 1 secs
wait 1 secs
say ReplyNumber
▷ Do as I say!
Rather than answering questions, Gobo could give Take a hike!
random orders, such as “run up and down the stairs”,
“jump in the air twice”, or “sing a famous song”. Just
change the text in the “say” blocks to Gobo’s commands.
You could also change Gobo’s appearance to something
grumpy to match the mood.
70 g e t t i n g s ta r t e d
Funny Faces
You can have lots of fun drawing your own sprites in
Scratch – you don’t have to stick to the ones in the sprite
library. Creating your own sprites will give your projects
a unique look. For this project, you can go wild making
facial features and accessories for a DIY face.
How it works
This project starts with a blank face surrounded by a
collection of eyes, noses, and other items that you can You can add up to 11
drag into the middle to create crazy expressions. Press eyes, but most sprites
the green flag to reset the face and start again. are just a single item.
Funny Faces
by MonsterFace321 (unshared)
Empty face
Bow tie
Mouth
f u n ny fac e s 71
Funny Faces
by MonsterFace321 (unshared)
Pig nose
Snotty
nose
Tongue
72 G e t t i n G s ta r t e d
Get painting
Dust off your digital overalls because it’s time for some
painting. Scratch has a great paint editor built in, so you
have all the tools you need to create a mini-masterpiece
for each body part and item of clothing.
Brush tool
Line tool
Colour palette
Selected colour
100%
Bitmap Mode
Convert to vector
Line thickness
f u n ny fac e s 73
The sprite’s
centre
74 g e t t i n g s ta r t e d
when clicked
go to x: 0 y: 0
ExpErt tips
Coordinates
To pinpoint any spot on the stage you can
use two numbers called coordinates. The Funny Faces
by MonsterFace321 (unshared)
x coordinate, written first, tells you how far
the point is across the stage horizontally. y
The y coordinate, written second, tells 180
you how far the point is up or down the (–190, 110)
stage vertically. The x coordinates go from (130, 90) (215, 90)
–240 to 240. The y coordinates go from 90
–180 to 180. The coordinates of a point
are written as (x, y). The centre of the
(x:0, y:0)
bow tie on the right, for instance, has x
coordinates (215, 90). –240 –120 0 120 240
(200, –80)
–90
Every spot on the stage has a unique
(x:120, y:–90)
pair of coordinates that can be used
to position a sprite exactly. (–120, –100) –180
f u n ny fac e s 75
Time to make lots of sprites
The more different eyes, noses, mouths, ears, hats, and
accessories your Funny Face project has, the more silly
faces you can make, so spend some time making as many
as you can. It’s great fun. You can also find useful items in
Scratch’s costumes library, such as hats and sunglasses.
You can skip the drawing stages for those.
Centre tool
10 Click the blue “i” on each sprite in the sprites list and
give your creation a meaningful name. Also make sure 11 When you’ve finished drawing a
sprite, drag it across the stage to
the “can drag in player” check box is ticked so you can its starting position outside the
drag the sprite around the stage in full-screen mode. face. Don’t worry if the sprites
overlap a bit.
Type a name for
the sprite here.
Eyes
x: 8 y: 42 direction: 90°
rotation style:
can drag in player:
show:
Make sure
this is ticked.
when clicked
go to x: 150 y: 100
Fill tool
Choose a colour.
100%
Bitmap Mode
Convert to vector
Clones
You might want to use some sprites lots of
times – perhaps your face will be funnier with
ten eyes rather than two. Scratch allows you
to “clone” a sprite to make fully working copies.
ExpErt tips
Clones
15 Make ten clones of the eye sprite
by adding this loop to its script.
Clones work a bit like the “stamp” block you
Now when you run the project
you can place all 11 eyes!
used in the Cat Art project. But while “stamp”
just draws a picture on the backdrop, the
clone block creates a working sprite. Clones
can be used for lots of clever things, as you’ll
when clicked see in later projects.
This loop creates 10
go to x: 200 y: 100 extra eyeballs on top
of the original.
create clone of myself ▾
repeat 10
when clicked
Increase the number
to make the sunglasses
go to x: 180 y: –30
more transparent.
turn 1 degrees
▽Snotty nose
To make disgusting green snot drip out of
the nose, create two new costumes for the 1
nose with spots of green colour. Then add
these new blocks to make the snot drip.
when clicked
go to front
This places the sprite in
front of the other sprites,
show covering them up.
hide
try this
3 Now run the project. Make a silly face and then
check if you can make the frame appear and
try something different
disappear with the space-bar and “c” key.
You can use this project to create
Funny Faces anything from snowmen and Christmas
by MonsterFace321 (unshared)
trees to monsters and aliens!
Art
82 art
How it works H A P PY
When you run this project, a
mysterious flashing green button
appears. Press the button and an
animated birthday card fills the Happy birthday
to you!
screen, complete with singing sharks.
The sharks take turns singing the
lines of the “Happy Birthday” song.
Birthday Card
by PartyPlanner120 (unshared)
Click the button to open The sharks drop in from the top
the birthday card. and then sing “Happy Birthday”.
b i r t h d ay c a r d 83
T H DAY !
B I R △ Gliding around
This project uses the “glide”
block, which makes sprites
move smoothly around
the stage. You need to use
Scratch’s coordinates system
to set the exact start and
finish point of each glide.
If you can’t remember how
coordinates work, see the
Funny Faces project.
△ Keeping time
Like Animal Race, this project
uses messages sent from one
sprite to another to control
the timing of scripts. The
singing sharks send messages
back and forth to time their
The cake slides into view lines of “Happy Birthday”.
from the edge of the stage.
84 art
Birthday button
To avoid spoiling the surprise of the card, all Surprise!
go to x: 0 y: 0
New backdrop:
show This makes the
button shimmer
with changing colours.
forever
New backdrop:
backdrop1 Clear Add Import
Text tool
Select tool
Font:
Helvetica ▾ 100%
Bitmap Mode
Convert to vector
Font menu
8
Make sure you still have the stage This block shows the
selected in the lower left of the Scratch white backdrop.
when clicked
window and not one of the sprites.
Click on the Scripts tab above the
switch backdrop to backdrop1 ▾
blocks palette and add these scripts
for the stage. Now try running the The “party” backdrop
project and see what happens with balloons appears
when you click the button. when I receive Go! ▾ when the button is pressed.
Click
here first.
New sound:
Cake
Birthday banner
The next thing needed for a party HAPPY BIRTHDAY
atmosphere is an animated birthday
banner that rocks back and forth.
or just an outline. Then use the text tool to add the words
“HAPPY BIRTHDAY!” Try whichever font and colours you
like. Use the select tool to position the text or trim the
banner to fit.
Centre tool
Rectangle
tool
Choose
Selected colour colours here.
100%
Outline
Bitmap Mode
Solid colour Convert to vector
b i r t h d ay c a r d 89
HA
HAPPY BIRTHDAY!
ExpErt tips
16 Now select the Scripts tab and add the banner’s
two scripts. These keep it hidden until the
Directions
button is pressed and then jiggle the banner
around. Run the project to check it works.
Scratch uses degrees to set the direction
of sprites. You can choose any number from
–179° to 180°. Remember, negative numbers
Reduce the y
point sprites left and positive numbers point
when clicked coordinate if your
banner is too high them right. Use 0° to go straight up and 180°
on the stage. to go straight down.
hide
–90° moves a
go to x: 0 y: 120 sprite straight 0°
to the left.
turn 20 degrees
It turns Use the blue “turn”
wait 1 secs clockwise. blocks to make the
turn 20 degrees banner turn.
Singing sharks
What’s the perfect finishing touch to a birthday surprise?
Yes, of course... singing sharks! The two sharks will take
turns singing by sending messages to each other after
each line of the song.
delete
Shark1 Shark1
save to local file
hide
The shark
starts out with
when I receive Go! ▾ a costume when I receive Go! ▾
that has its
show mouth closed. show
21 Time to get the sharks singing. Remember the loop belonging to the cake sprite
that plays Happy Birthday? It sends the message “Line1” every time the song
starts. Add the scripts shown on the left to Shark1 and the scripts on the right
to Shark2 to make them react to the message. More messages make them take
turns to sing each line. You’ll need to create new messages for each line of the
song. Name them by using the drop-down menu in the “broadcast” blocks.
Shark1
when clicked
hide
hide show
repeat 50
change size by 5
when I receive Go! ▾
△ Adding photos
Why not try importing a photo of the birthday boy
or girl into the project? You can upload any picture
you like to make a new sprite by clicking the upload
symbol in the sprites list. But don’t share projects
containing people’s photos without their permission.
Happy birthday
to you...
New sound:
△ Adding sound
You don’t have to use Scratch’s built-in sounds and songs – △ Birthday dancers
you can add your own music or record your very own version Why not reuse some of your dancers from the
of “Happy Birthday” if you want. Click the upload symbol Dino Dance Party in your birthday card? If you
in the Sounds tab to add a sound file from your computer. do, adjust the timing of the costume change
Click the microphone symbol to record your own sounds. so they dance in time to the music.
94 art
Spiralizer
Try out this spinning spiral project. Click the icon to
Change the patterns using special make the spiral
fill your screen.
sliders to alter the values of variables
in the code. You control the art – the
Spiralizer
possibilities are endless! by SpiralAttack (unshared)
Angle 10
△ Clones
Clones are working copies
of sprites. When a clone is
created, it appears on top
of the existing sprite and
has the same properties,
such as direction, size,
and so on.
△ Scratch pen
Every sprite can draw a
trail behind it wherever
it goes – just add the
dark green “pen down”
block to its script. Try out
the other blocks in the
Pen section of the blocks
palette to change the
pen’s colour, shade,
and thickness.
96 art
forever
when clicked This shrinks
the ball.
move 2 steps
set size to 30 %
This block moves
go to x: 0 y: 0
the ball to the
centre of the stage.
forever ▷ What’s going on?
The parent sprite changes its
create clone of myself ▾ direction a little before each clone is
created. As a result, the clones move
turn 10 degrees off in slightly different directions,
one after another. Each clone travels
Each time this
block runs, a new
in a straight line to the edge of the
clone is made. stage, making the clones form an
ever-expanding spiral pattern.
Taking control
There are two numbers in the ball’s scripts that you can change to alter
the spiral’s appearance. One is the change in the angle before each new
clone appears. The other is the number of steps in the “move” block,
which determines the clones’ speed. If you create variables for these
numbers, Scratch lets you add a slider control to the stage so you can
change them while the project is running. This makes experimenting easy.
Speed 0
Angle
Speed
when clicked
Angle 10
Angle 10
normal readout
Speed
Move the two sliders
large readout slightly apart on the
stage so that you can
slider see them fully.
Speed 2
hide
set size to 30 %
This block removes
all pen trails so the go to x: 0 y: 0
stage starts blank.
forever
clear
This activates create clone of myself ▾
the pen so set pen size to 1
that every
turn Angle degrees
clone leaves
pen down Type 1 in here
a trail.
for a thin pen.
Angle 10 Angle 7
Speed 2 Speed 2
spiralizer 101
when clicked
set Angle ▾ to 10
set Speed ▾ to 2
set size to 30 %
go to x: 0 y: 0
clear
pen down
forever
Spiralizer Spiralizer
by SpiralAttack (unshared) by SpiralAttack (unshared)
Angle 10 Angle 31
Speed 2 Speed 10
Pen size = 1, Angle = 10, Speed = 2 Pen size = 1, Angle = 31, Speed = 10
Spiralizer Spiralizer
by SpiralAttack (unshared) by SpiralAttack (unshared)
Angle 10 Angle 10
Speed 2 Speed 2
Pen size = 10, Angle = 10, Speed = 2 Pen size = 100, Angle = 10, Speed = 2
spiralizer 103
forever OK Cancel
These hide
the sliders.
Spiralizer
◁ Ball control
by SpiralAttack (unshared) Instead of generating clones in a spiral pattern, you
Angle 10 can make them follow the mouse-pointer. Just replace
the “turn” block with a “point towards mouse-pointer”
Speed 2 block. Now try painting with the mouse.
try this
Clone lab
Experiment with clones to get a feel for how in a “go to x: y:” block to see some crazy effects.
they work. Start a new project and add a clone You can even add some keyboard controls and
creation loop to the cat and give each clone a sound effects for fun. Once you’ve mastered
simple script to run when it starts. Experiment clones, you’ll find you can do all sorts of things in
with a “pen down” block or put random numbers Scratch that are almost impossible without them.
if on edge, bounce
106 art
Fantastic Flowers
Create a virtual meadow and fill it Type the name of
the project here.
with colourful flowers. In this project,
you’ll learn how to make your own
customized Scratch blocks. Each time
Fantastic Flowers
one of these runs, it triggers a special by Buttercup (unshared)
script called a subprogram, which
paints a flower.
How it works
When you run the project, a flower appears
wherever you click the mouse. Scratch uses
a simple ball sprite and a “stamp” block to
draw each flower. The ball stamps an image
of itself to create each petal, moving back
and forth from the flower’s centre each time.
draw flower
△ Subprograms
Scratch lets you create your own custom blocks
to trigger scripts that you’ve built. Then, instead
of repeating the whole script each time you need
it, you simply use the new block. Programmers
use this trick all the time and call the reused
code a subprogram.
△ Adding inputs
You can create blocks that have windows for
inputting numbers or other information, like
the example shown here, which lets you set
the number of petals.
fa n ta s t i c f lo w e r s 107
I think it must
be spring!
108 art
repeat 5
It moves back It then turns to face a new
move 25 steps to the centre. direction. There are 360 degrees
in a full circle, so each turn is
stamp
one-fifth of a circle.
move –25 steps 4 5
ExpErt tips
Doing maths
Computers are very good at maths. You can Add Subtract
use the green Operators blocks in Scratch to
do simple sums. For more complex calculations, + –
you can also put Operators blocks inside each Divide
other or combine them with other blocks. If
blocks are put inside each other, the computer * /
works from the innermost blocks outwards,
as if the inner blocks were in brackets. Multiply (Computers usually
use a * sign to avoid confusion
with the letter x.)
fa n ta s t i c f lo w e r s 109
More blocks
The next step is to turn the flower-drawing
code into a flower-drawing block. You
can then use this block to grow flowers
wherever you want.
Make a Block
OK Cancel
move 25 steps
stamp
define draw flower
move –25 steps
stamp
110 art
Fantastic Flowers
The blocks inside the “if then” by Buttercup (unshared)
go to mouse-pointer ▾
draw flower
stamp
▾ Options
Add number input:
OK Cancel
112 art
▾ Options
Add number input:
OK Cancel
move 25 steps
Drag the “number
stamp of petals” block into
these two places.
move –25 steps
stamp
fa n ta s t i c f lo w e r s 113
when clicked
forever
go to mouse-pointer ▾
draw flower 7
when clicked
Click here if you want to
delete an input window.
forever
draw flower 7
▾ Options
Add number input:
move 25 steps
set colour ▾ effect to petal colour
stamp
stamp
go to mouse-pointer ▾
when clicked
clear
forever
In Scratch, colours go
if mouse down? then from –100 to 100.
go to mouse-pointer ▾
pick random –100 to 100
draw flower 6 70 100
pick random 5 to 10
Flower stalks
Real flowers grow on stalks, so follow the next few steps to
add stalks to your virtual flowers to make them look more
realistic. Using custom blocks makes the code easy to read
so you always know what’s going on.
Motion Events
Looks Control draw stalk length thickness
Sound Sensing
Pen Operators ▾ Options
Data More Blocks Add number input:
change y by length
when clicked
clear
Stalk length
forever
draw flower pick random 5 to 10 pick random –100 to 100 pick random –100 to 100
blue sky
492x367
playing–field
480x360
118 art
▷ Different petals 6
Why not use the costume editor to add a
different petal to the flowers? Click on the
Costumes tab and add a new costume with the
paint symbol . Oval petals work well. You’ll
need to add blocks to the “define draw flower”
petal2
script to swap between the petal costume 72x22
and the ball-a costume for the flower’s centre.
▽ Flowers everywhere
Try swapping the main script for this one. It draws
flowers in random places automatically, eventually
covering the stage with them. Think about how
you could add position inputs to the “draw flower”
when clicked The chosen ranges block – you’d need to add x and y inputs and add
keep the flowers a “go to” block at the start of the block’s definition.
clear
away from the edges.
forever
draw flower pick random 5 to 10 pick random –100 to 100 pick random –100 to 100
fa n ta s t i c f lo w e r s 119
Different sizes
By adding another input to the “draw flower”
block, you can control the size of your flowers. 1 Right-click the “define” header to edit it and
add a new input called “scale”. Make the
changes shown below to the script. When
You can also make the meadow look more 3D scale is set to 100 in the “draw flower” block,
by making the flowers smaller if they’re near the flowers are drawn at their usual size.
the top of the stage, as though further away. Smaller numbers will produce smaller flowers.
define draw flower number of petals petal colour centre colour scale
stamp
go to mouse-pointer ▾
Tunnel of Doom
Scratch is the ideal playground for making and
perfecting games. To win at this game, you need The cat starts here.
How it works
Use your mouse to move the cat all the way through
the tunnel without touching the walls. If you
accidentally touch a wall, you go back to the start.
You can try as many times as you like, but the clock
will keep counting the seconds until you finish.
◁ Cat sprite
Once the mouse-pointer has
touched the cat, the cat follows
it everywhere. You don’t need
to use the mouse button.
◁ Tunnel
The tunnel maze is a giant sprite that
fills the stage. The tunnel itself isn’t
actually part of the sprite – it’s a gap
that you create by using the eraser tool
in Scratch’s paint editor. If the cat stays
in the middle of the path, it won’t be
detected as touching the tunnel sprite.
◁ Home
When the cat touches the home sprite,
the game ends with a celebration.
tunnel of doom 123
Do you dare
to enter the
“Tunnel of Doom”?
Will your time
Time in seconds be the fastest?
Time 201
Cat
x: 84 y: -69 direction: -90°
rotation style:
can drag in player:
Sprite1 show:
drum eggs
tunnel of doom 125
Fill tool
Eraser tool
100%
Selected colour
Bitmap Mode
Convert to vector
126 games
Eraser tool
forever
Tunnel
change colour ▾ effect by 2
Mouse control
Now to add some scripts to the cat to turn the
project into a working game. The scripts build
step by step, so test them as you go along to
check they work properly.
11 Select the cat sprite and add this script. It shrinks the cat
and positions it at the start of the tunnel. Once the mouse-
pointer touches the cat, it will move with the mouse. Note
Choose a smaller size
that players don’t need to click on the cat to pick it up. The
if the cat gets stuck
script stops with a “meow” if the cat touches the tunnel walls. too easily in the tunnel.
ExpErt tips
repeat until loops
The useful “repeat until” loop
repeats the blocks inside it until
when clicked
the condition at the top of the
block becomes true, and then repeat until touching Bone ▾ ?
the blocks below are run. The block
makes it easier to write simple, dig
readable code, like this example.
eat bone
Unlike the “forever” block,
“repeat until” has a bump at
the bottom allowing more
blocks to be added to it.
12 Run the game. You should be able to control the cat once
you’ve touched it with your mouse-pointer. Try moving it
along the tunnel. If you touch the wall, the cat will meow
and get stuck. If the cat gets stuck too often, reduce the
number in the “set size” block, but don’t make it too easy.
TRY
AGAIN!
Drag the top of the “forever”
block above the “go to” block when clicked
and it will expand to fit
around all the blocks below.
set size to 20 %
go to front
forever
go to x: –210 y: 160
go to mouse-pointer ▾
go to x: –210 y: 160
forever
wait 1 secs
change Time ▾ by 1
One is added
to the value of
“Time” each second.
Click in the
centre of
the sign.
To draw perfect
Well done circles, hold shift Well done Centre tool
when you use
you did it! this tool. you did it!
Ellipse tool
132 games
show
go to front
forever
Window Cleaner
Messy windows? You’d better get up and clean them!
This frantic game counts how many splats you can
clean off your computer screen in a minute. You
can wipe away the splats either by using a computer
mouse or by waving your hand in front of a webcam.
How it works
The game starts by cloning a splat sprite and scattering ▽ Splat sprite
clones with different costumes randomly across the stage. This game has one sprite
with several costumes,
When motion is detected by the webcam, Scratch uses
which you’ll paint yourself.
its “ghost” effect to make the splats fade. If you wave your By cloning the sprite you
hand enough, they eventually disappear. The aim of the can cover the screen with
game is to remove as many splats as you can in one minute. splats of messy gunk.
Window Cleaner
by PaintChampion (unshared)
Score 42
Countdown 8
△Controls
First you’ll clean up the
splats with your mouse,
but later you can change
the code to detect the
Each splat is a clone of Wave your hand to movement of your hand
the project’s single sprite. rub out the splats. with a webcam.
window cleaner 135
Slime time!
To make some mess on the screen, you need to
draw some slimy splats. Follow these instructions
and you’ll be in a mess in no time at all.
Brush tool
100%
Bitmap Mode
Convert to vector
136 games
Vanishing splats
Now it’s time to add code to the splat sprite
to make the game work. Follow the next steps to
make several clones appear and then disappear
when the mouse-pointer touches them. The maximum number of
splats that can be on the
screen at any one time.
set MaxSplats ▾ to 10
set SplatsOnScreen ▾ to 0
set Score ▾ to 0
forever
Goodbye splat!
change Countdown ▾ by –1
show
repeat 5
Window Cleaner
by PaintChampion (unshared)
It’s easier to
play this game in
full-screen mode.
slider
if costume # = 1 then
hide
change Blue Score ▾ by 1
Difficulty 40
Each costume colour will need
an “if then” block like this.
Simulations
144 s i m u l at i o n s
Virtual Snow
You don’t want real snow inside your computer –
it would melt and ruin the circuits. This project
shows you how to make perfectly safe virtual
snow using Scratch. It falls from the sky and
can be made to settle on the ground or stick
to things.
How it works
Each snowflake is a clone that moves down
the stage from top to bottom, jiggling from side
to side like a real snowflake. When the snowflake
lands on something or hits the bottom, it stamps
an image of itself.
The snowflakes are clones
of a simple circle shape.
Virtual Snow
by Snowman001 (unshared)
△ Hidden pictures
You can add invisible objects
that slowly reveal themselves
as the snow sticks to them. Use
a sprite from the library, draw
Snow falls from the top The snow piles your own object, or write your
and settles at the bottom. up on the sprite. name in huge letters.
virtual snow 145
Let it snow
Start off by drawing the snowflake costume,
which is simply a white circle. Then make it snow
by creating clones – each one a tiny snowflake
falling from the top to the bottom of the stage.
Ellipse tool
Select white.
100%
Bitmap Mode
Convert to vector
Choose solid
colour here.
146 s i m u l at i o n s
New costume:
costume1 Clear Add Import
costume1
50x50
The costume’s
size is shown
here.
Select tool
Stage
Click here to 1 backdrop
paint a new
backdrop. New backdrop:
virtual snow 147
Fill tool
The background
fades from dark
blue to a paler blue.
100%
Vertical gradient
Bitmap Mode
Convert to vector
Choose these
two colours.
set size to 10 %
This shrinks
forever the snowflake.
stamp
Click here and then click on anything
delete this clone white in Scratch to set the colour.
There’s no business
12 Run the project and watch the snow
pile up. You’ll notice a problem. The
Virtual Snow
by Snowman001 (unshared) like snow business!
snowflakes are building up in beautiful
sculptures rather than settling in a
blanket, as real snow does.
Snowflakes stick to
anything white.
150 s i m u l at i o n s
stamp
pick random 1 to 6 = 1
delete this clone
stamp
stamp
Secret pictures
It’s easy to modify this project so that the snow sticks
to an invisible object, slowly revealing it. Save your
project as a copy before you try doing this.
go to x: 0 y: 0
Put the number of
costumes here.
152 s i m u l at i o n s
show
The snow no longer
forever
settles at the bottom
change y by –3 of the stage.
A 1 in 20 chance of
if y position < –175 then
sticking lets snow
fill the whole shape.
delete this clone
stamp
Snow sticks to the
delete this clone ghosted sprite.
How it works
Click anywhere on the stage to make a
rocket shoot up to that point and explode
into a colourful firework. Each firework
consists of hundreds of clones of a single
sprite. The project uses simulated gravity
to make the clones fall as they fly outwards,
while flickering or fading.
◁ Rocket
Each firework starts off as a rocket
launched at the click of a mouse.
You can use a simple coloured line to
represent the rocket or create a more
detailed one in Scratch’s paint editor.
◁ Clones
To create the globes of coloured
“stars”, this project uses 300 clones,
the maximum number that Scratch
allows. Each clone follows a slightly
different path at a slightly different
speed to make the stars spread out
in a circle.
f i r e w o r k d i s p l ay 155
Each explosion is
made up of hundreds
of clones that spread
out from the rocket.
Creating the rocket 1 Start a new project and delete the cat sprite by
right-clicking on it and then selecting “delete”.
The first step in the project is to create the Click on the paint symbol in the sprites list
small rocket that shoots up into the sky to create a new sprite and open the paint editor.
and explodes in a blaze of fireworks. The Rename the sprite “Rocket”.
script will make the rocket fly to wherever
New sprite:
you click the mouse-pointer.
Fill tool
100%
Bitmap Mode
Convert to vector
100%
when clicked
The loop pauses
6 Next, select the rocket sprite and
add this script to make it shoot up
to wherever the mouse is clicked.
hide until the mouse
is clicked.
forever
The rocket starts at the
wait until mouse down? bottom, directly under
the mouse. This block makes
go to x: mouse x y: –180 the rocket move
smoothly upwards.
show
hide
broadcast Bang ▾
Choose “new message” The stage turns white
and call it “Bang”. for an instant.
Exploding stars 8 Click the paint symbol in the sprites list to create a
new sprite and call it “Stars”. Before drawing it, select
Real fireworks are packed with hundreds “Convert to vector” in the bottom right of the paint
of “stars” – flammable pellets that glow editor, as using vector graphics will help keep the
with dazzling colours as they fly apart and stars circular even when they are very small.
burn. You can simulate the appearance
of firework stars by using Scratch’s clones
feature. Follow the instructions here to 1600%
repeat 300
Speed of Speed of
slowest stars fastest stars
when I receive Bang ▾
show
The stars spread out
repeat 50 in every direction.
▽ Sticky stars
You might sometimes see a trail of stars in a line if you send up a rocket
straight after running the project. This happens if the stars explode
before all the clones are created. To fix the bug, add a “broadcast” block
to the bottom of the “when flag clicked” script in the stars sprite and
change the rocket’s script to run only after it receives the message.
hide hide
forever
repeat 300
wait until mouse down?
create a clone of myself ▾
go to x: mouse x y: –180
show
hide
broadcast Bang ▾
▽ Changing colours
Firework-makers use chemicals to create different
The colours
colours. Try this hack to the stars sprite to make change as the
the colours change as the firework explodes. firework expands.
▷ Gravity trails
To make the stars arc downwards when I receive Bang ▾
under the pull of gravity, leaving
set speed ▾ to pick random 0.1 to 3
colourful trails in their wake,
rebuild the script as shown here. set ghost ▾ effect to 0
Remember to delete the original
change colour ▾ effect by 25
script when you’ve finished. As
the timer increases, the stars pen up
The pen creates
fall more quickly, which is how go to Rocket ▾ the trails.
gravity really works. See if you
can figure out how to change the pen down
colour of the trails or make them point in direction pick random –180 to 180
brighten or fade out (hint: you’ll
need to use the “set pen colour” show
and “set pen shade” blocks). reset timer
repeat 50
This sets the timer to
zero. It then counts move speed steps
up in seconds.
change y by 0 – timer
change y by 0 – timer
Fractal Trees
You might think that drawing a tree Click here to make the
tree fill your screen.
requires an artistic eye and a lot of
fiddly work, but this project does the
job automatically. The code creates
Fractal Trees
special shapes called fractals, simulating by SkilledGardener (unshared)
the way that trees grow in nature.
How it works
When you run the project, a tree grows in
a split second from the ground up. The tree
is a fractal – a shape made from a repeating
pattern. If you zoom in to just a part of a
fractal, it looks similar to the whole shape.
This repetition is easily generated in
a computer program by using loops.
Branches are
drawn with the
Scratch pen.
This section looks
like a miniature
version of the
whole tree.
f r ac ta l t r e e s 163
Romanesco broccoli
△ Fractals in nature
Lots of natural objects have
fractal shapes, including
trees, river systems, clouds,
blood vessels, and even
broccoli. Natural fractals
form most often when
something keeps dividing
into branches, which is how
trees and blood vessels grow.
164 s i m u l at i o n s
How it works
In the project Dino Dance Party, we saw how the ballerina’s
dance routine is based on an algorithm – a set of simple
instructions that are followed in strict order. In this project,
the code that draws the tree is also based on an algorithm.
Try following the three steps below with a pen and paper.
Make a Variable
Length
Leaf
ShrinkFactor
f r ac ta l t r e e s 165
when clicked
clear
pen up
set size to 10 %
set Angle ▾ to 30
These three variables
set Length ▾ to 90 set how the tree looks.
go to x: 0 y: –170
▽ Different angles
Try experimenting with the value of “Angle” in the first orange block. You could also
add a “pick random” block to generate randomly shaped trees. If you want to keep
trees looking natural, set the minimum and maximum to 10 and 45. To make playing
with the variable easier, check its tick box to show it on screen and turn it into a
slider. You’ll need to delete the “set Angle” block from the script if you do this.
▽ Ever-changing angles
If you move the “set Angle” block inside
the “repeat” loop, the angles between
branches will change as the tree grows.
repeat 8
broadcast
set Angle ▾ to pick random 10 to 45
Angle = 30
Length = 90
ShrinkFactor = 0.5
Grow a forest
You can adapt this project to grow trees wherever
you click, covering the stage with a forest. Make
the following changes to the script to do this.
Fractal Trees
by SkilledGardener (unshared)
when clicked
clear
forever
set size to 10 %
The branches are shorter
set Angle ▾ to 25
to make the trees smaller.
set Length ▾ to 30
point in direction 0 ▾
The trunks start thinner
set pen colour to
because the trees are smaller.
set pen size to 6
pen down
repeat 8
Snowflake Simulator
Snowflakes are famous for their
amazingly varied shapes – it’s said
Snowflake Simulator
that no two are the same. Even by WhiteSnow2 (unshared)
so, all snowflakes share the same
underlying structure, with six similar
sides. This pattern, known as six-fold
symmetry, makes snowflakes easy
to mimic on a computer. You can
use the same technique used in
the Fractal Trees project, but this
time every shape will be unique.
How it works
When you run this project, a snowflake
appears on the stage. Later you can make
snowflakes appear wherever you click.
Each snowflake is a bit like a fractal tree
with six trunks. By using random numbers
to set the lengths and angles of the white
lines, you can create an endless variety
of unique shapes – just like in nature.
s n o w f l a k e s i m u l at o r 173
△ Real snowflakes
Snowflakes are six-sided because
they grow from ice crystals, which
are hexagonal. As a snowflake
grows, slight changes in air
temperature affect the way ice
crystals build up. Because every
snowflake follows a different
path and experiences different
changes in temperature, every
snowflake is unique.
△ Snow-FAKE
The drawing starts with six versions
of the sprite to match the six-fold
symmetry of a real snowflake.
After that, the lines split in two
repeatedly, like the fractal tree,
but with more varied angles.
174 S i m u l at i o n S
Symmetrical branches
To see how this project uses the ideas from Fractal
Trees to make a snowflake, start by following these
steps to create a simple, non-random snowflake.
Angle
Length
Levels
Stage Symmetry
1 backdrop Click here to select
the backdrop.
SymmetryAngle
New backdrop:
go to x: 0 y: 0
This calculates the angle
between each arm.
pen down
repeat Symmetry – 1
The loop adds five
create clone of myself ▾ clones pointing in
different directions.
turn SymmetryAngle degrees
when clicked
set Symmetry ▾ to 6
clear
set Levels ▾ to 4
set pen colour to
go to x: 0 y: 0
pen down
repeat Symmetry – 1
set Length ▾ to 20
set Angle ▾ to 15
Add a new loop to
create the branching broadcast Draw Level ▾ and wait
pattern on each arm.
s n o w f l a k e s i m u l at o r 177
Use full-screen
mode to see a bigger
snowflake up close.
repeat Levels
▷ Oddflakes
Try this quick change set Length ▾ to pick random 30 to 150
to make odd-looking
snowflakes. It varies repeat Levels
the line lengths after
each branch point,
creating a wider range set Angle ▾ to pick random 140 to 180
of flaky weirdness.
broadcast Draw Level ▾ and wait
Move the “set Length”
block into the “repeat” loop.
s n o w f l a k e s i m u l at o r 179
▽ Click-a-flake
Snowflake Simulator
Make snowflakes wherever you click
by WhiteSnow2 (unshared)
on the stage with these modifications
to the code. There’s also a script to clear
the stage when you press the space-bar
in case things get too messy. Make sure
you keep the script from step 7.
Snowflakes appear
wherever you click.
when clicked
set Symmetry ▾ to 6
set Levels ▾ to 4
clear
pen up
Replace the old “go to”
go to mouse-pointer ▾ block with this new one.
pen down
repeat Symmetry – 1
Change the numbers to
create clone of myself ▾ make the snowflakes smaller.
This script clears the
turn SymmetryAngle degrees
stage of snowflakes.
broadcast Kill All Clones ▾ and wait when I receive Kill All Clones ▾
Add this block so Scratch
delete this clone
won’t run out of clones.
Music and
sound
182 Music and sound
How it works
Sprites and Sounds couldn’t be easier to play – simply ▽ Virtual circus
click the sprites or the background and you’ll hear This entertaining project is a
mix of funny sounds and moves.
a sound and see an animation or visual effect. You can add as many sprites and
sounds as you want to spice up
the show.
The project works best in full-screen
mode, which stops you from
accidentally moving the sprites.
Click anywhere
on the stage for
some sound
and action.
Each sprite
performs its
own little
show when
clicked.
SpriteS and SoundS 183
Background action Altogether
Everything in this project does something now!
interesting when it’s clicked, including the
background. Follow these steps to create
the background, and then start adding sprites.
2
Sprites
Stage fairydust
Sprite1 00:00.51
2 backdrops
New backdrop:
Sprite extravaganza!
Now add the following sprites and their scripts. Some of the sprites have the right
sounds built in, but in other cases you’ll need to open the Sounds tab and load
the sound from Scratch’s sound library before you can select it in the script. After
building each script, position the sprite on the stage and test it.
move 10 steps
Duck
play sound duck ▾ until done
Laughing duck
move –10 steps
7
This lights
the candles.
when this sprite clicked
turn 30 degrees
point in direction 90 ▾
8 9
repeat 16
repeat 6
The horse runs
back and forth. move 5 steps
Load the
“bubbles” sound
from the library.
Fish 3 repeat 2
Chilling fish point in direction –90 ▾
wait 1 secs
The fish flips
left and right point in direction 90 ▾
calmly while the
bubbles make a wait 1 secs
gurgling sound.
sprites and sounds 187
repeat 10
Lion Monkey2
change y by 10
King of the jungle Jumpy monkey
wait 0.1 secs
Changing the monkey’s change y by –10
y coordinate moves
when this sprite clicked it up or down.
wait 0.1 secs
switch costume to lion-b ▾
Cheese puffs
The last sprite is a bowl of tasty-looking cheese puffs –
when you click on the bowl, the cheese puffs will vanish.
There isn’t a suitable costume for the empty bowl, but you
can create one using Scratch’s paint editor. The following
steps show you how.
Use this
cheesy-puffs duplicate tool to
88x58
draw
delete an oval.
wait 1 secs
Microphone volume:
recording1
00:00.00
2
Edit ▾ Effects ▾
Microphone volume:
recording1
00:00.00
190 music and sound
Drumtastic
This project turns your computer keyboard into a drum
machine. Type in anything you want and Scratch turns
the letters into repeating drum sounds using up to
18 different instruments, from cymbals and bongos
to pounding bass drums.
▽ Scratch drumkit
How it works The script turns every letter
When you run the project, the Scratch cat asks you to into a drum sound. There are
26 letters in the alphabet but
type something in the box. When you press return, the Scratch only has 18 drum
code turns each letter into a different sound and plays sounds, so some sounds
the phrase back over and over again. As the sounds are used for two letters.
play, the coloured drums on the stage flash in time,
while the Scratch cat walks to the beat.
A
Drumtastic
Snare drum
by Drummer242 (unshared)
B
Bass drum
C
Side sticks
OK Cancel
Click here.
Click “OK” to Choose this option.
complete the block.
192 music and sound
when clicked
ask Type something to make a drum sequence. Then press return. and wait
change Count ▾ by 1
With each loop, a different letter
is set as the input in the “play a
drum” block.
On to the
next letter.
d r u m ta s t i c 193
s c r a t c h
(12) Triangle l
(13) Bongo m
Alphabet
Uncheck the (14) Conga n
tick boxes so
the variables AlphabetCount (15) Cabasa o
don’t appear
on the stage. (16) Guiro p
ChosenDrum
(17) Vibraslap q
NumberOfDrums
(18) Open Cuica r
194 music and sound
forever
set Count ▾ to 1
change Count ▾ by 1
next costume
set ChosenDrum ▾ to 0
play drum 1 ▾ for 0.25 beats
set AlphabetCount ▾ to 1 Delete the block.
Start
at “A”. repeat length of Alphabet
Is the chosen
change AlphabetCount ▾ by 1 On to the next Play the chosen
number
bigger than letter of the drum sound.
the number alphabet.
if ChosenDrum = 0 then
of drums?
Move it back rest for 0.25 beats No drum picked? Just
into range. take a short break.
d r u m ta s t i c 195
Drum1
hide
set ChosenDrum ▾ to 0
set drumID ▾ to 1
set size to 50 %
point in direction 90 ▾
Each drum is a
repeat NumberOfDrums different colour.
go to x: 0 y: 0
Next drum
change tempo by 2
change tempo by –2
Mindbenders
200 mindbenders
How it works
I am
The spots take turns to disappear and reappear very quickly, number 5!
causing a gap in the circle that races round. This confuses
your brain, which fills in the missing spot with its opposite
colour, creating a magic green spot that doesn’t exist. Keep
watching and the magic green spot will erase all the pink
spots, but this is just an illusion too! △ Clones with identity
Keep your eyes fixed
Each circle is a clone. In this project,
on the cross to see you’ll see how each clone can have
This illusion works best
the illusion. its own copy of a variable – in this
in full-screen mode.
case, an ID number that’s used to
control which circle is hidden at
The Magic Spot
any moment.
by Illusionist101 (unshared)
Scripts Costumes
800%
Bitmap Mode
Convert to vector
Circle of clones
Now to fill in the background and create the circle
of clones. The script will give each clone a unique
identification number that will make it easy to hide. Sprites
New backdrop:
Click here to create
a new backdrop.
the magic spot 203
id
“Make a variable”. Create a variable called “id”
Type
and select the option “For this sprite only”. This
“id” here.
is important as it allows each clone to have its For all sprites For this sprite only
own copy of the variable with its own value.
Uncheck the tick box in the blocks palette so Select this
option.
that the variable doesn’t show on the stage. OK Cancel
turn 30 degrees
when I start as a clone
change id ▾ by 1
say id
The clone is given
a unique number.
204 Mindbenders
10 2
The original
sprite doesn’t
run the “say”
block.
3
9
2 8 4
1 3
7
6
5
when clicked
when I receive Hide Spot ▾
switch costume to Spot ▾
go to x: 0 y: 0 if id = Hidden then
set id ▾ to 0 else
repeat 12 show
turn 30 degrees
change id ▾ by 1
set Hidden ▾ to 0
The “Hidden” variable
forever controls which spot hides.
change Hidden ▾ by 1
if Hidden = 12 then
The “Hidden” variable
counts up to 11 and then set Hidden ▾ to 0
jumps back to zero.
This number controls the wait 0.1 secs Open the menu and
speed at which the magic create a new message
spot moves around the circle. called “Hide Spot”.
206 Mindbenders
17 Run the project. You should see the gap move around the circle. Put the
stage into full-screen mode and stare at the cross. Within a few seconds,
you’ll see the magic green spot. Keep staring at the cross and the magic
spot will start to erase the pink spots. When you look away from the Stare at the cross
cross, you’ll just see the empty gap again. to see the illusion.
expert tips
if then else
The “if then” block is very useful for either
running or skipping a group of blocks
depending on the answer to a question. But
what if you want to do one thing for yes (true) Does my
and another for no (false)? You could use two id = “Hidden”? Hide
“if then” blocks, but programmers face this Yes
problem so often that they created another (true)
No
solution: “if then else”. The “if then else” block (false)
has two jaws, for two sets of blocks. The top
set runs on yes, the bottom set runs on no. Show
the magic spot 207
hide
else
show
△ Colour controls
To find out which colours make the illusion strongest,
create a new variable called “SpotColour” and add a slider
to the stage. Add a “set colour effect” block to the sprite’s
script under the “when I receive” block. Run the project
and try different colours. Which ones work best? Does
the magic spot change colour too?
try this
speed it up
Try adding a new variable, called “Delay”, to
set the speed of the magic spot. You’ll need to
add these two blocks to the script – see if you set Delay▾ to 1
can figure out where to put them. Right-click
(or control/shift-click) on the variable on the
stage and choose “slider”. Does the illusion wait Delay / 100 secs
still work if you slow it right down?
208 Mindbenders
Spiral-o-tron
by Hypnotic09 (unshared)
The coloured
line thickens
in response
to loud noises.
The spiral is
drawn using the
Scratch pen.
Spiral-o-tron 209
Build the spiral
This project shows you how to use Scratch’s pen
to create fast-moving, interactive effects. Follow
the steps below to build a simple spiral first.
backdrop2
Spiral 480x360
draw spiral
Type “draw spiral”.
▸ Options
Click “OK” to OK Cancel
make the block.
210 Mindbenders
5 You will now see the “define draw spiral” header in the scripts
area. Add the following script to it. Read through the Scratch
blocks and think about the steps. Don’t run the project yet
as there isn’t any code to trigger the new block.
pen up
pen down
repeat Repeats
pen up
set TurnAngle ▾ to 6
These blocks set
the properties of set StartDirection ▾ to 0
our spiral.
set pen size to 5
clear
draw spiral
spiral-o-tron 211
30 seconds to draw.
▾ Options
define draw spiral
Add number input:
10 Now run the project and the spiral will appear so quickly
that you won’t see it happen. The next trick is to keep
redrawing the spiral in different positions so it appears
to spin. Add a new variable called “SpinSpeed”, untick
its box, and change the main script to look like this.
when clicked
set TurnAngle ▾ to 6
set StartDirection ▾ to 0
set SpinSpeed ▾ to 10
set pen size to 5
Full-screen mode
go to x: 0 y: 0
set DrawLength ▾ to 0
change pen colour by ColourChange
pen down
repeat Repeats
pen up
214 mindbenders
set TurnAngle ▾ to 6
set ColourChange ▾ to 3
set Sensitivity ▾ to 3
Scratch constantly measures Louder noises make
forever the sound volume and gives thicker spirals.
this block a value from 0 to100.
clear
draw spiral
As the volume rises,
the colour flows
change StartDirection ▾ by SpinSpeed along the spiral.
▽ Presets ▽ Hiders
If you use your sliders to make a spiral you really You can add scripts like these to show and
like, write down all the values and then create a hide your sliders when you hit certain keys.
“preset” to set those values at the touch of a key. That way they won’t spoil the view!
set TurnAngle ▾ to 4
try this
sound reaction
You can have a lot of fun in other
projects making sprites react to when clicked loudness
Next steps
After working through this book, your knowledge of Scratch should
be strong enough to take you to new places. Here’s some advice
on taking your coding skills to the next level, as well as a few
suggestions on where to find inspiration for your own projects.
Exploring Scratch
The Scratch website www.scratch.mit.edu is a great place to see other
people’s work and share your own projects. Click “Explore” at the top
of the website to view projects that other Scratchers have shared.
Explore
Featured
I can answer your
yes-or-no questions.
All
Ask your question
then press space.
Animations
Click on any
Art project to
open its
Games Spiralizer Firework Display Ask Gobo project page.
by SpiralAttack by MagicLight01 by FortuneTeller100
Music 924 500 27 8224 883 496 40 7727 352 285 17 4325
Instructions
Tag: Go
Click anywhere on the stage to launch a firework.
You can only launch one firework at a time.
your favourites list. 597 812 25718 26 project and change the code,
look for an orange “remix”
Click the heart if Total views button. This links your new
you love a project. project to the original.
next steps 219
▷ Sharing
To share one of your projects with other Scratchers, open
the project and click the “Share” button at the top of Scratch.
Anyone can find your project once you’ve shared it. You can
also see how many fellow Scratchers have tried your projects,
and people can “favourite” and “love” your project too.
▽ Doodling
Scratch is designed to make experimenting easy. Just when clicked
add a sprite you like and create some fun scripts like
these. Maybe turn on the pen to see what loopy forever
pattern your sprite makes. Play with variables and
add sliders so you can see their effects immediately. if touching Elephant ▾ ? then
when clicked
forever
if a = 2 then
if a == 2:
say Hello!
print(‘Hello!’)
else else:
say Goodbye! print(‘Goodbye!’)
Scratch Python
220 W H AT N E X T ?
Glossary
algorithm call event GUI
A set of step-by-step To use a function, procedure, Something a computer The GUI, or graphical user
instructions that perform or subprogram. A custom program can react to, such interface, is the name for
a task. Computer programs block in Scratch is a call to as a key being pressed or the buttons and windows
are based on algorithms. the “define” script with the the mouse being clicked. that make up the part of
same name. the program you can see
animation execute and interact with.
Changing pictures quickly clone See run
to create the illusion A fully functioning copy hack
of movement. of a sprite that can move export An ingenious change to code
and run scripts on its To send something to the that makes it do something
backpack own, separate from computer from Scratch, such new or simplifies it. (Also,
A storage area in the original sprite. as a sprite or a whole project accessing a computer
Scratch that allows saved as a computer file. without permission.)
you to copy things condition
between projects. A “true or false” statement file hardware
used to make a decision A collection of data stored The physical parts of a
bitmap graphics in a program. See also with a name. computer that you can see
Boolean expression. or touch, such as wires, the
Computer drawings
fractal keyboard, and the screen.
stored as a grid of
pixels. Compare coordinates A pattern or shape that
with vector graphics. A pair of numbers that looks the same when you header block
pinpoint an exact spot zoom in or out, such as the A Scratch block that starts
block on the stage. Usually shape of a cloud, a tree, or a script, such as the “when
written as (x, y). a cauliflower. green flag clicked” block.
An instruction in Scratch
Also known as a hat block.
that can be joined to other
blocks to build a script. costume function
The picture a sprite shows Code that carries out a import
Boolean expression on the stage. Rapidly specific task, working like a To bring something in from
changing a sprite’s program within a program. outside Scratch, such as a
A statement that is either
costume can create Also called a procedure, picture or sound clip from
true or false, leading to
an animation. subprogram, or subroutine. the computer’s files.
two possible outcomes.
Boolean blocks in Scratch
are hexagonal rather data global variable index number
than rounded. Information, such as text, A variable that can be A number given to an item
symbols, or numbers. changed and used by in a list.
branch any sprite in a project.
A point in a program debug input
where two different To look for and correct gradient (colour) Data that is entered into a
options are available, errors in a program. Moving smoothly from one computer. Keyboards, mice,
such as the “if then else” colour to another, like the sky and microphones can be
block in Scratch. directory during a beautiful sunset. used to input data.
A place to store files to
bug keep them organized. graphics integer
A coding error that makes Visual elements on a screen A whole number. An integer
a program behave in an ellipse does not contain a decimal
that are not text, such as
unexpected way. An oval point and is not written as
pictures, icons, and symbols.
a fraction.
glossary 221
interface out, such as checking programming language sprite
See GUI whether two values are A language that is used A picture on the stage in
equal or adding two to give instructions to Scratch that a script can
library numbers together. a computer. move and change.
A collection of sprites,
costumes, or sounds output project stage
that can be used in Data that is produced by Scratch’s name for a program The screen-like area of the
Scratch programs. a computer program and and all the sprites, sounds, Scratch interface in which
viewed by the user. and backdrops that go projects run.
list with it.
A collection of items stored particle effect statement
in a numbered order. A visual effect in which Python The smallest complete
lots of small patterns A popular programming instruction a programming
local variable move in an organized language created by language can be broken
A variable that can be way to create a larger Guido van Rossum. Python down into.
changed by only one pattern. Particle effects is a great language to learn
sprite. Each copy or in Scratch usually after Scratch. string
clone of a sprite has use clones. A series of characters. Strings
its own separate version random can contain numbers, letters,
of the variable. physics A function in a or symbols.
The science of how things computer program that
loop move and affect each allows unpredictable subprogram or subroutine
A part of a program that other. Including physics outcomes. Useful when Code that carries out a specific
repeats itself, removing is often important in creating games. task, working like a program
the need to type out the simulations and games – within a program. Also called
same piece of code for example, to create run a function or procedure.
multiple times. realistic gravity. The command to make
a program start. turbo mode
memory pixel art A way of running Scratch
A computer chip inside A drawing made of giant Scratcher projects that makes the
a computer that pixels or blocks, mimicking Someone who uses Scratch. code work much faster than
stores data. the appearance of graphics normal. You can switch turbo
in early computer games. script mode on and off by holding
message A stack of instruction the shift key as you click the
pixels blocks under a header green flag.
A way to send information
between sprites. The coloured dots block that are run in order.
on a screen that tweak
network make up graphics. server A small change made to
A computer that stores files something to make it work
A group of interconnected
procedure accessible via a network. better or differently.
computers that exchange
data. The internet is a Code that carries out a
specific task, working variable
giant network. simulation
like a program within A place to store data that can
A realistic imitation of
a program. Also called a change in a program, such as
operating system (OS) something. A weather
function, subprogram, the player’s score. A variable
The program that controls simulator might re-create
or subroutine. has a name and a value.
everything on a computer, the action of wind, rain,
such as Windows, OS X, and snow. vector graphics
program
or Linux. Computer drawings stored
A set of instructions software
that a computer follows as collections of shapes,
operator Programs that run on making them easier to
in order to complete a computer and control
A Scratch block that uses change. Compare with
a task. how it works.
data to work something bitmap graphics.
222 W h at n e x t ?
Index
centre tool 73, 76, 89, 131, 146, 156, creating 187, 201–02 Fractal Trees 23, 162–71, 172, 174
158, 202 library 75 fractals 162, 220
chance 60 modifying 187 in nature 163
“change colour effect” block 26, naming 202 framing 79
Page numbers in bold refer 30, 196 Costumes tab 21, 37, 118, 136, 164 full-screen mode 20, 31, 69, 82,
to main entries. “change pen colour” block 101, countdowns 57, 138, 141 103, 166, 177, 212
103, 213 cursor tools 20 function 220
“change size” block 92 custom blocks 106–19, 191, 209 Funny Faces 70–79
“change whirl effect” block 92
A Christmas cards 153
addition 108
afterimages 200
“clear” block 31, 101, 110, 114
“clear graphic effects” block 33 D G
algorithms 15, 44, 164, 220 clones 77, 220 data 220 games consoles 15
“and” block 55, 150 adding movement to 96 Data blocks 50, 59, 63, 65, 97, 131, games projects 13, 15, 120–41
Animal Race 22, 48–59 creating symmetrical patterns 136, 159, 164, 174, 191 Tunnel of Doom 22, 122–33,
animations 182, 184, 188, 220 with 175 debug 220 140
arrow keys 32, 42, 43, 104, 197 deleting 97, 99, 101, 148, 149, 170 “define” blocks 211 Window Cleaner 22, 134–41
art projects 13, 22, 80–119 drums 195–96 “define” header block 110, 111, 112, ghost effect 33, 78, 92, 134, 139,
Birthday Card 22, 82–93 Firework Display 154–61 113, 116, 119 151, 159
Fantastic Flowers 22, 106–19 Fractal Trees 163–66 degrees, and direction 89 “glide” block 83
Spiralizer 22, 94–105 hiding 104 dice 64 global variables 220
Ask Gobo 22, 60–69 maximum number 96, 149, 154, difficulty Gobo 60–69
atmosphere 124–25 169, 179 making games harder 58 “go to” blocks 76, 105, 127, 131
Snowflake Simulator 175–77 slider 141 “go to front” block 153
special script affecting 96 Dino Dance Party 17, 22, 34–47, “go to mouse-pointer” block 28,
Spiralizer 94–97 164 127
B stamping a copy 149
unique identification number
directions 89
directory 220
gradient tool 147, 157
graphics 13, 220
backdrop 17
adding a message to 84–85 195, 196, 202, 203–04 division 108 “greater than” block 66
changing colour 167 Virtual Snow 144, 145, 147–49 Drumtastic 23, 190–97 green flag 17, 29
library 39, 51, 119, 152, 183 Window Cleaner 134, 136–39 grow tool 202
loading a new 39, 51, 62, 86 clubs, coding 8, 219 GUI (graphical user interface)
backpack 19, 21, 220
Birthday Card 22, 82–93
code 15
coding Eedit custom block 10–11, 221
H
“Bitmap Mode” 72 parties 219 111–13
blocks 16, 220 what is coding? 10–23 editing sounds 189
actions performed by 17 colour editor mode 96 hack 220
custom 106–19 blending 146 ellipse tool 75, 145, 187, 201 hacks and tweaks
ready-made 15, 16 changing 26, 30–31, 32, 78, “equal to” block 66 Animal Race 57–58
running faster 211 160–61, 207 eraser tool 122, 125, 126, 187 Ask Gobo 67–69
blocks palette 20, 21, 28–30, 159 gradient 147, 157, 220 Events blocks 29, 31 Birthday Card 92–93
bookmarking projects 218 optical illusion 200–07 explosions 154, 158–59 Cat Art 32–33
Boole, George 66 colour palette 72, 73, 77, 125, 146, export 220 Dino Dance Party 46–47
Boolean conditions 66 201 Drumtastic 197
Boolean expressions 220 conditions 66, 220 Fantastic Flowers 118
Boolean operator: “not” 55
boxes, drawing 85, 146, 156
Control blocks 29
control key 19 Ffaces, creating your own 70–79 Firework Display 160–61
Fractal Trees 168–69
broadcast blocks 91, 160 controls Funny Faces 78
“broadcast message” block 54 camera 134, 139–40 “fairydust” 183 The Magic Spot 207
“broadcast and wait” block 165 keyboard 42, 188 Fantastic Flowers 22, 106–19 Snowflake Simulator 178–79
brush tool 72, 73, 75, 135, 146, 156 making games harder 58 “favourite” 219 Spiral-o-tron 215
bugs 15, 220 mouse 19, 28–29, 122, 127–30, File menu 36 Spiralizer 103–05
see also hacks and tweaks 134, 138, 154, 156, 157 files 220 Sprites and Sounds 188–89
touchscreen 182 fill tool 73, 77, 79, 97, 125, 136, 147, Tunnel of Doom 132–33
“Convert to vector” 158 174, 191, 203, 209 Virtual Snow 153
Firework Display 23, 154–61
C
coordinates 74, 83, 87, 89, 105, 118, Window Cleaner 140–41
131, 220 fisheye effect 33 hand movement, controlling by
C programming language 14 copies of projects 57, 93 Font menu 85 134
C++ programming language 14 costume editor 118 “for this sprite only” variable 159 hardware 220
calculations 108 costumes 220 “forever” block 17, 29, 33, 129 header blocks 220
call 109, 110, 220 centring 146, 158 “forever” loops 42, 46, 67, 78, 137, “hide” block 151
camera control 139–40 changing 37, 43, 78, 132 179, 196, 212, 213 “Hip-Hop” dance postures 47
Cat Art 22, 26–33 checking size 201–02 fortune-telling project 60 hypnotic effect 212
Index 223
Iice crystals 173 M offline Scratch 18
online Scratch 18
Funny Faces 22, 70–9
The Magic Spot 200–07
Mac computers 18 operating systems (OS) 14, 221 sharing 218, 219
“if then” blocks 42, 43, 66, Magic Spot, The 23, 200–07 operators 221 Snowflake Simulator 172–79
97, 110, 130, 141, 149, 150, “Make a Block” 109, 209 Operators blocks 55, 66, 108 Spiral-o-tron 208–15
194, 206, 219 “Make a variable” button 50 optical illusions 23, 200–07, 212 Spiralizer 22, 94–105
“if then else” block 206 maths 108 “or” block 55 Sprites and Sounds 182–89
information storage, variables mazes 122–23, 125–27, 132 OS X computers 18 Tunnel of Doom 22, 122–33
48, 51 menus 20 output 221 Virtual Snow 144–53
input 220 message blocks 54–55, 130 Window Cleaner 22, 134–41
input windows 111, 112, messages 48, 221 Python 15, 219, 221
113, 191 microphone 208, 214
integer 220
interactive features 15
symbol 93, 189
mindbenders 23, 198–215
P
interface, Scratch 10–11
internet 18
The Magic Spot 23, 200–07
Spiral-o-tron 23, 208–15
paint editor
Birthday Card 88 QR
Dino Dance Party 37 questions, asking 60–69
invisible objects 144, 151–52 Minecraft 15 Firework Display 156 random block 150, 159
mirror images 46 Funny Faces 72–74 random locations 137
mobile phones 15 Magic Spot 201, 202 random numbers 60, 63, 64,
Moiré patterns 100
JK More blocks 109, 191, 209
Motion blocks 28, 41, 76
Snowflake Simulator 174
Tunnel of Doom 122, 125, 131
67–69, 105, 115, 172
random orders 69
Java 15 Virtual Snow 145, 146 Raspberry Pi 18, 19
JavaScript 15 motion detection 134, 139, Window Cleaner 135 recordings 93, 188
keyboard 140 parent sprite 96 rectangle tool 75, 79
letters as sounds 190, mouse particle effect 154, 160, 221 “remix” button 218
193–95 control 28–29, 122, 127–30, parties, coding 219 repeat loops 46
and mouse control 19 134, 138, 154, 156, 157 Pen blocks 30, 31, 95 Birthday Card 92
shortcuts 103 creating scripts 16 “pen down” block 95, 100, 105, 210 Dino Dance Party 44–45
sprite control 42, 188 mouse-pointer “pen up” block 210 Drumtastic 192, 194, 196
moving sprites 26, 104 photos, adding 93 Fantastic Flowers 108, 112
right-clicking 19 physics 221 Firework Display 159
NO
196, 210 Birthday Card 22, 82–93 website 218
repeat until 128 Cat Art 22, 26–33 Scratch pen 94, 95, 100–02, 162,
and repeating patterns 162, names, player’s 50, 51 Dino Dance Party 34–47 208–09, 219
164, 168, 176, 178 networks 221 Drumtastic 190–97 Scratchers 221
and sprite movement 38 “new message” block 54 Fantastic Flowers 22, 106–19 scripts 16, 221
“loudness” block 215 “next costume” block 37, 38 Firework Display 154–61 building 16, 28–29
“love” 218, 219 “not” block 55 Fractal Trees 162–71 changing 30
224 W h at n e x t ?
running 29 special effects 13, 26, 33, 67, 78, statements 221 Fractal Trees 164–65
timing of 83 92, 153 “stop” block 59 global 220
triggering (“calling”) 109, 110 speech bubbles 61, 191 strings 192, 221 for individual clones 97–99, 159,
working together 17 Spiral-o-tron 23, 208–15 Studios tab 218 195, 200, 203
scripts area 20, 21, 28 Spiralizer 22, 94–105 subprograms 106, 110, 221 local 221
Scripts tab 21, 38, 89, 147, 203 sprites 16, 221 subtraction 108 The Magic Spot 207
secret pictures 144, 151–52 adding accessories to 75 subtraction block 119 playing with 219
“See inside” 218 adding code 136, 137 supercomputers 15 position 59
select tool 85, 88, 156 adding more 51–53, 57, 132 symmetry and random numbers 63, 64
Sensing blocks 42 adding movement 16, 41 six-fold 172, 173 sliders to alter value of 94,
servers 221 adding sounds 182–89 values 175 97–99, 102
“Share” button 219 adding speech 47 Snowflake Simulator 174
sharing projects 218, 219 built-in sounds 184 Spiral-o-tron 209, 212, 213, 214
shift key 19, 131, 145, 151
shortcuts, keyboard 103
centre point 73, 76, 131
changing colour 16, 67 Ttabs 20, 21 Window Cleaner 136
vector graphics 158, 221
shrink tool 202 changing costumes 36, 37, 67 vertical gradient 147, 157
simulations 23, 142–79, 221 changing size 32, 62, 92, 119, templates 118 Virtual Snow 23, 144–53
Firework Display 23, 154–61 127, 128, 129, 130 tempo 197 volume 214, 215
Fractal Trees 23, 162–71, 172, 174 copying 39 text tool 85
Snowflake Simulator 23, 172–79 creating your own 16, 70–79, 88, thought bubbles 59
Virtual Snow 23, 144–53
W
151, 156, 188 touchscreen computers 182
singing animals 197 dancing 34–47 trees
six-fold symmetry 172, 173 delivering messages 16 fractal 162–71 “wait” blocks 38, 152, 179
sliders invisible 151–52 true/false statements 55, 66 “wait until” blocks 55, 196
difficulty 141 mouse control 122–23, 127–30 Tunnel of Doom 22, 122–33, 140 web browsers 14, 18
hiding 104, 215 painting new 135–36 turbo mode 151, 152, 221 webcams 134, 139–40
playing with 219 painting with 26–33 “turn” blocks 78, 89, 98, 112, 166, websites 15
and value of variables 94, 97–99, renaming 52, 74, 76, 88, 124, 127, 196 Scratch 18, 218
102, 103, 215 145, 164 “turn 180 degrees” block 46 “when green flag clicked” block
Snowflake Simulator 23, 172–79 selecting new 36, 62 tweaks 29
software 18–19, 221 setting direction of 99 see hacks and tweaks “when I receive” block 165, 166,
sound 13, 180–97 sprite library 36, 75, 96, 188, 195 two-player games, Animal Race 48 170, 177, 196
adding 93, 124, 141, 214 sprites list 20 “when space key pressed” block
Drumtastic 190–97 using photos to make 93 31, 197
editing 189
previewing 124
see also clones
Sprites and Sounds 23, 182–89 UV Window Cleaner 22, 134–41
Windows operating system 14, 18
recording your own 188, 189, 214 stage 17, 20, 221 undo 126 word processors 14
library 40, 57, 86, 124, centre of 74 unpredictability 60, 64
130, 141, 184–87, 188 clearing 31, 33, 99, 110, 115, 179 upload 93
Spiral-o-tron 208, 214
Sprites and Sounds 182–89
decorating 51
flashing 156
variables 51, 221
Animal Race 48, 50, 51 XYZ
tempo 197 position on 74 Ask Gobo 60, 63, 64, 65, 66 x coordinates 74
volume 214, 215 scripts 40 countdown 138 y coordinates 74
Sound blocks 184 see also backdrop difficulty 139, 140, 141 yes/no questions
sound effects 57, 67, 105, 132, 189 “stamp” block 26, 30, 31, 77, 106, Drumtastic 191, 193, 195 Boolean operators 55
Sounds tab 21, 40, 57, 124, 183, 108, 149–50, 170 experimenting with 168–69 if then else 206
184, 188 starfield 153 Fantastic Flowers 119 zoom 21, 158
Acknowledgments
Dorling Kindersley would like to thank Caroline Hunt for proofreading; The publisher would like to thank the following for their kind
Helen Peters for the index; Sean Ross for help with Scratch; Ira Pundeer permission to reproduce their photographs:
for editorial assistance; Nishwan Rasool for picture research assistance;
and Vishal Bhatia for pre-production assistance. (Key: a-above; b-below/bottom; c-centre; f-far; l-left; r-right; t-top)
Jon Woodcock would like to thank all his code clubbers over the 134 123RF.com: Jacek Chabraszewski (b); Dreamstime.com: Pavel Losevsky
years for teaching him how to think in Scratch; and Matty and Amy (b/background); 163 Corbis: Trizeps Photography / photocuisine (cra); NASA:
for all their questions. (cr); Science Photo Library: SUSUMU NISHINAGA (crb); 173 NOAA: (tr)
Scratch is developed by the Lifelong Kindergarten Group at MIT All other images © Dorling Kindersley
Media Lab. See http://scratch.mit.edu For further information see: www.dkimages.com