Programming With Scratch Booklet v3 1
Programming With Scratch Booklet v3 1
with Scratch
A step-by-step guide, linked to the English
National Curriculum, for primary school teachers
http://computingchampions.co.uk
@computingchamps
License
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
(CC BY-NC-SA 4.0) license. The license can be viewed at: http://creativecommons.org/licenses/by-nc-
sa/4.0/
Acknowledgements
Parts of this work build on the Scratch Planning examples provided by Phil Bagge at http://code-it.co.uk/ in
accordance with the Creative Commons Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) license.
The license can be viewed at: http://creativecommons.org/licenses/by-nc/3.0/
• design, write and debug programs that accomplish specific goals, including controlling or simulating
physical systems; solve problems by decomposing them into smaller parts
• use sequence, selection, and repetition in programs; work with variables and various forms of input
and output
• use logical reasoning to explain how some simple algorithms work and to detect and correct errors
in algorithms and programs
Task overview:
• Literacy – speaking and listening; drama; speech punctuation; feelings and emotions of characters
• History – interviewing historical figures
• Geography – conversation between two people from contrasting environments
• PSHCE – discussing feelings towards an issue, such as bullying
• Science – highlighting misconceptions about a particular topic
Firstly, delete the cat sprite so Click on the cross to the top
we can use something more right of the cat in the Sprites
interesting Area and select Delete
It’s now time for our sprites to Click on your first Sprite in the
have a conversation. To do Sprites Area. Click on Code at
this, we need a Green flag to the top of the Block Pallet if the
start the program (Script) and a Script Area is not visible
number of instructions in order
On the left of the Block Pallet, Sprite 1
click on Events and drag a
when Green Flag clicked block
into the Script Area (in the
middle of the screen)
Congratulations! You’ve created your first program in Scratch. You’ve written a program to achieve a
specific goal, sequenced instructions and worked with outputs (the text displayed on the screen). You’ve
also probably corrected errors in your program, which is known as debugging.
Extension activities
For each of the activities below, feel free to experiment with a range of features to make your program as
engaging as possible.
• Get the Sprite to move towards the character (Hint: have a look in Motion)
• Play a sound instead of using a Say block (Hint: try looking in Sound)
• Change the appearance of the Sprite after they’ve spoken (Hint: use a Next Costume block in
Looks)
• Alter the background after one of the characters has spoken (Hint: the required block is in Looks)
• Add a third character (Sprite) to the conversation
If you have access to a micro:bit, you could include additional functionality within your program.
• Enable a button press or an action to start your program (Hint: replace the when Green Flag clicked
block with one of the blocks below)
• Have some text or an image display at the end of the program (Hint: add one of the blocks below
after your existing instructions)
In Activity 1, Wait blocks were used to ensure the characters spoke in turn. Using Wait blocks in this way is
quite inefficient and creates lots of extra work if we want to add additional events, such as movement,
sound or further speech. We’re now going to alter each Sprite’s script to use Broadcast messages, which
pass a message to a Sprite to ensure it only undertakes an action when it receives a specified command
(rather than relying on a certain period of time).
When working with children, this can be effectively demonstrated by whispering to a few pupils that when
they hear a specified code word, such as “Dave”, they have to get up and do five star jumps. “Dave” is then
shouted out (i.e. Broadcast) to the class, but only the children given the code word know to act upon it.
Sprite 1
Click on your first Sprite and
drag a Broadcast block from
Events, along with a Say, for,
seconds block and a when
Green Flag clicked block
Sprite 2
Click on your second Sprite
and drag a When I receive
block from Events, followed by
a Say, for, seconds block
• design, write and debug programs that accomplish specific goals, including controlling or simulating
physical systems; solve problems by decomposing them into smaller parts
• use sequence, selection, and repetition in programs; work with variables and various forms of input
and output
• use logical reasoning to explain how some simple algorithms work and to detect and correct errors
in algorithms and programs
Task overview:
Initially, we need to ask the user a question and allow them to Input the answer. Although quizzes can be
produced for any topic, it’s best to initially only ask questions with numerical answers, which minimises
errors relating to spelling or typing.
As with the first task, delete Click on the cross to the top
the cat Sprite so we can use right of the cat in the Sprites
something else Area and select Delete
Add some additional questions Add further Ask and if, then,
using the same process else blocks to your Script
containing different questions
and answers
Well done! You’ve made another program in Scratch. This time you’ve also used selection and worked with
both inputs and outputs. We’re now going to add a score to our game using a variable.
A variable is similar to a box. It can contain anything the computer can store, such as numbers or text. Its
contents can be changed, or varied (hence the name variable), and we can find out the contents of the box
at any time.
When the quiz starts, we have Drag the set, to block from Data
to ensure the score starts at to immediately below the when
zero, rather than continuing Green Flag clicked block in your
from the previous game script (this ensures it’s the first
instruction run)
Good work! You’ve now used a variable to record the score. You have also output the variable to the
screen for the user to see.
Extension activities
For each of the activities below, feel free to experiment with a range of features to make your program as
engaging as possible.
• Adjust the score to decrease when the user gets a question wrong (Hint: change the score by -1)
• Make the character move or dance when an answer is correct (Hint: look in Motion)
• Get the character to include the user’s answer when they speak – e.g. “Well done. The answer was
10” (Hint: you’ll need to use a Join block from Operators)
• Change the background when the score reaches ten (Hint: add an if, then block to check the score
and perform an action if Score = 10)
If you have access to a micro:bit, you could include additional functionality within your program.
• Make the micro:bit display the score (Hint: add the block below before each question is asked)
• Ask different questions depending on whether the user starts the game using button A or B (Hint:
you could have separate question blocks for each button, or have the buttons alter the times table
used to ask questions)
Written by Neil Rickus. Licensed under CC BY-NC-SA 4.0 11
Programming with Scratch
• design, write and debug programs that accomplish specific goals, including controlling or simulating
physical systems; solve problems by decomposing them into smaller parts
• use sequence, selection, and repetition in programs; work with variables and various forms of input
and output
• use logical reasoning to explain how some simple algorithms work and to detect and correct errors
in algorithms and programs
Task overview:
Our first task is to make our character look like they’re moving as they travel around the maze. We also
need to control the character using the keyboard.
You’ve produced yet another program in Scratch. Within the program, you’ve used repetition to make the
character move across the screen. Repetition has been combined with selection to enable keyboard input,
which alters the location of the sprite output to the screen.
The next stage in producing our game is to create the maze. We also need to program our sprite to perform
a sequence of instructions if it touches the maze wall.
Your Sprite is probably too large Change the value in the Size box
to move around the maze, so we at the top of the Sprites Area to
need to make it smaller reduce the size of the Sprite
Brilliant! You’ve created a game involving a Sprite interacting with the background, that responds to a
number of inputs (the keyboard and touching a colour). Repetition and selection have again been used,
along with instructions in sequence. You’ll be beginning to see how programs can be built by decomposing
them into smaller parts.
Extension activities
For each of the activities below, feel free to experiment with a range of features to make your program as
engaging as possible.
• Include sound effects when the character moves / hits the wall (Hint: look in Sound)
• Change the Sprite to a ghost if it touches the wall (Hint: you’ll need to add a new Costume)
• Add a score that increases for every second the character avoids touching the side (Hint: combine a
variable for the score with a Wait block)
• Instead of ending the game when the character touches the wall, get it to automatically change
direction (Hint: remove the Stop block and look in Motion)
• Add objects (e.g. coins) to collect (Hint: add some extra Sprites and Hide them when touched)
• Include a second level (Hint: you’ll need an end point, of a different colour, in your first maze, which,
when touched, should change to your second maze background)
If you have access to a micro:bit, you could include additional functionality within your program.
• Instead of using the keyboard to control your Sprite, tilt the micro:bit to make it move (Hint: replace
the key, pressed blocks with the blocks below)
• design, write and debug programs that accomplish specific goals, including controlling or simulating
physical systems; solve problems by decomposing them into smaller parts
• use sequence, selection, and repetition in programs; work with variables and various forms of input
and output
• use logical reasoning to explain how some simple algorithms work and to detect and correct errors
in algorithms and programs
Task overview:
A leading game manufacturer wants to see how well you can program.
They have asked you to design a game that involves moving a character around obstacles or away from
enemies.
If you wish, you can plan your moving sprite game and start programming immediately. Alternatively, you
can use the example game specification below, or the more detailed instructions overleaf, which break
down the necessary steps for each requirement.
Within school, pupils should be given a planning template and asked to solve the programming challenge
by splitting it into smaller parts. This is known as decomposing. This would typically involve specifying the
required steps, or script, to complete each section of the program.
Basic: A frog has to move across the road from his pond. The frog is controlled using the keyboard.
Butterflies automatically move along the road. If the frog collides with a butterfly, he becomes injured and
the game ends. The frog should always start from his pond at the bottom of the screen.
Intermediate: The frog starts with a score of 100, which should decrease by 5 for every second it takes to
cross the road. The frog starts with three lives. Every time the frog collides with a butterfly, he loses a life.
Once the frog has lost all his lives, the game ends. A "game over" message or screen should be displayed,
along with an appropriate sound.
Advanced: Each butterfly’s speed should increase as the game progresses. Once the frog crosses the road
and reaches a certain point on the other side, he should progress to the next level. He should also get an
extra 100 points.
For each sentence of the Basic example game specification, the required steps are outlined below,
although a similar result can often be achieved using other blocks or scripts
If the frog sprite is touching the Place a forever loop after the
butterfly sprite, then we want when Green Flag clicked
the frog to say “Owwww” for a block, followed by an if, then
period of time, followed by block inside the loop
ending the game
Text: The frog should always Drag your frog Sprite to your
start from his pond at the preferred starting position on
bottom of the screen the Stage (in the pond)
For the Intermediate and Advanced example game specification, step-by-step instructions are not provided.
However, guidance for how to complete each part of the specification is outlined below. As with the Basic
guidance, similar results can often be achieved in a number of ways.
The frog starts with three lives. Every time the frog • Create a variable for the lives
collides with a butterfly, he loses a life • Set the variable to 3 when the game starts
• When the frog touches a butterfly, change the
score by -1
Once the frog has lost all his lives, the game ends • If the lives variable is zero, stop the game
A "game over" message or screen should be When the lives variable reaches zero, either:
displayed
• Say a specific message
• Change the backdrop to a special “game over”
screen
Along with an appropriate sound • Play a sound when the lives variable reaches
zero
Once the frog crosses the road and reaches a • Create a sprite or coloured area at the top of
certain point on the other side, he should progress the screen
to the next level • When the frog touches the area or sprite, the
backdrop should change
• The starting position of both the frog and
butterflies may also need to be altered
He should also get an extra 100 points • When changing the backdrop, change the
score variable by 100
For each of the activities below, feel free to experiment with a range of features to make your program as
engaging as possible.
• Include sound effects when the character moves / hits the enemies (Hint: look in Sound)
• Change the Sprite to something different if it touches a butterfly (Hint: you’ll need to add a new
Costume)
• Get the butterflies to change direction (Hint: use a turn block)
• Make the frog bounce across the stage if he touches the side (Hint: look in Motion)
• Add objects, such as food, for the character to collect (Hint: add some extra Sprites and Hide them
when touched)
• Have different enemies, such as dogs or dinosaurs, on each level (Hint: only show certain sprites
when a certain backdrop is selected)
• Rather than your frog automatically moving forward, program the up and down arrows to move the
sprite forwards and backwards respectively
• Include additional levels
If you have access to a micro:bit, you could include additional functionality within your program.
• Make the micro:bit display a timer showing you how long it took the frog to reach the finish
• Alter the controls to use either the micro:bit’s buttons or tilt sensor to move the frog
• Use the buttons to alter the difficulty at the start of the game
• use two or more programming languages, at least one of which is textual, to solve a variety of
computational problems
• design and develop modular programs that use procedures or functions
• understand simple Boolean logic [for example, AND, OR and NOT] and some of its uses in circuits
and programming
Task overview:
A leading game manufacturer was impressed with your moving sprite game. They now want you to produce
a platform game.
They have asked you to make a one-player game, which involves moving a sprite along various platforms.
The sprite is likely to have to jump over gaps between platforms, in addition to avoiding obstacles and
enemies.
If you wish, you can plan your platform game and start programming immediately. Alternatively, you can
use the example game specification below, or the more detailed instructions overleaf, which break down
the necessary steps for each requirement.
Within school, pupils should be given a planning template and asked to solve the programming challenge
by splitting it into smaller parts. This is known as decomposing. This would typically involve specifying the
required steps, or script, to complete each section of the program. They should also identify sections of
code that can be reused and included within a procedure.
Basic: A sprite has to move along the ground or on platforms. The sprite is controlled using the keyboard.
The sprite should fall to the ground if not on a platform. The sprite should be able to jump onto platforms
and be able to jump a range of different heights. The sprite should start on the left hand side of the screen
and move right along the ground / platforms. The code should be implemented using procedures where
possible.
Intermediate: The sprite should move realistically, including when jumping or falling. The sprite starts with
three lives. The sprite should have to avoid enemies and lose a life if he collides with an enemy. Once the
sprite has lost all his lives, the game ends. A "game over" message or screen should be displayed, along
with an appropriate sound.
Advanced: Once the sprite reaches a certain point on the right hand side of the screen, a "congratulations"
message must appear and he should progress to the next level. The sprite has a set amount of time to
complete the level. Levels should scroll over more than one screen where possible.
For each sentence of the Basic example game specification, the required steps / blocks are outlined below,
although a similar result can often be achieved using other blocks or scripts
For the Intermediate and Advanced example game specification, blocks of code are not provided. However,
guidance for how to complete each part of the specification is outlined below. As with the Basic guidance,
similar results can often be achieved in a number of ways.
The sprite starts with three lives. The sprite should • Create a variable for the lives
have to avoid enemies and lose a life if he collides • Set the variable to 3 when the game starts
with an enemy. Once the sprite has lost all his • When the sprite touches an enemy, change the
lives, the game ends score by -1
Once the sprite has lost all his lives, the game • If the lives variable is zero, stop the game
ends
A "game over" message or screen should be When the lives variable reaches zero, either:
displayed
• Say a specific message
• Change the backdrop to a special “game over”
screen
Along with an appropriate sound • Play a sound when the lives variable reaches
zero
The sprite has a set amount of time to complete • Create a variable for the time and reduce it by
the level one every second
• When the variable reaches zero, display the
"game over" message / screen
Levels should scroll over more than one screen • Create the adjoining part of the level sprite and
where possible hide it when the game starts
• As the sprite moves right, move both the
background sprite left at the same rate as the
sprite
For each of the activities below, feel free to experiment with a range of features to make your program as
engaging as possible.
• Include sound effects when the character moves / hits the enemies (Hint: look in Sound)
• Change the Sprite to something different if it touches an enemy (Hint: you’ll need to add a new
Costume)
• Allow the player to select their Sprite at the start of the game (Hint: you could use a range of
Costumes or independent sprites)
• Get the enemies to move at random (Hint: look in Operators)
• Add objects, such as food, for the character to collect (Hint: add some extra Sprites and Hide them
when touched)
• Have an end of level boss to get past (Hint: only show certain sprites when certain co-ordinates are
reached)
• Give the sprite ability to fire custard pies or a similar, non-threatening, weapon at enemies (Hint:
add an additional sprite, which moves from the main sprite when a certain key is pressed)
• Include additional levels
If you have access to a micro:bit, you could include additional functionality within your program.
• Make the micro:bit display the number of lives the dog has left
• Alter the controls to use either the micro:bit’s buttons or tilt sensor to move the frog
• Use the buttons to alter the difficulty at the start of the game