0% found this document useful (0 votes)
7 views122 pages

Getting started with Scratch Guide_RaspberryPi

This document serves as a guide for beginners to get started with Scratch, a graphical programming language developed by MIT. It covers the basics of setting up Scratch, creating an account, and developing projects using code blocks to create animations, stories, and games. The guide also provides step-by-step instructions on using the Scratch editor and includes tips for navigating and utilizing Scratch effectively.

Uploaded by

johanriese
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views122 pages

Getting started with Scratch Guide_RaspberryPi

This document serves as a guide for beginners to get started with Scratch, a graphical programming language developed by MIT. It covers the basics of setting up Scratch, creating an account, and developing projects using code blocks to create animations, stories, and games. The guide also provides step-by-step instructions on using the Scratch editor and includes tips for navigating and utilizing Scratch effectively.

Uploaded by

johanriese
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 122

3/6/24, 6:29 AM Getting started with Scratch

Projects

Getting started with Scratch


Learn about Scratch and develop your skills to use
Scratch independently

Step 1 What is Scratch?

Scratch is a graphical programming language developed by the Lifelong Kindergarten group at the MIT Media Lab.
In Scratch, you can drag and combine code blocks to make a range of programs, including animations, stories,
musical instruments, and games. It’s a bit like the programming equivalent of building blocks!

Scratch is used in many schools as part of the curriculum. It is free, and young people can use it at home as well as
in clubs.
Scratch allows young people to learn coding concepts and create interactive projects without needing to learn a
text-based programming language. You will not need to be able to type quickly or remember complex code to use
Scratch.
How to use this reference guide
If you have not used Scratch before, then this guide will help you to set up and create your first project.
You can return to this guide and use it to look up information that you need when you are making your own
projects in Scratch.
At the end of the guide you will find links to paths of Scratch projects, from beginner through to advanced, where
you can learn coding by making fun and interesting apps, games, stories, animations, art and music.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 1/122
3/6/24, 6:29 AM Getting started with Scratch

What you will need


Hardware
A computer or tablet capable of running Scratch 3

Software
This guide will explain how to get started with Scratch 3 (either online (https://scratch.mit.edu/) or
offline (https://scratch.mit.edu/download))

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 2/122
3/6/24, 6:29 AM Getting started with Scratch

Step 2 Set up Scratch

You can use Scratch on a laptop or desktop computer, or on a tablet. You can also use Scratch on a Raspberry Pi
computer.

Open a web browser on your computer or tablet and visit rpf.io/scratch-new (https://rpf.io/scratch-n
ew) to open a new project in the Scratch editor. Scratch will open in a new tab in your web browser.
Tip: You can also visit scratch.mit.edu (https://scratch.mit.edu/) and then click on Create.

Working offline without an internet connection


If you need to work offline (without an internet connection), then you can download Scratch (http
s://scratch.mit.edu/download) and install it on a computer.

You cannot work offline if you are using a tablet.

Scratch on Raspberry Pi
If you are using a Raspberry Pi computer, Scratch may already be installed. Click on the Raspberry Pi
icon to open the menu, then click on Programming, then select Scratch 3.
If you need to install Scratch, follow this process:
Click on the Raspberry Pi icon to open the menu
Click on Preferences
Click on Recommended Software
Select Scratch 3
Click on OK

See Scratch 3 Desktop for Raspberry Pi (https://www.raspberrypi.org/blog/scratch-3-desktop


-for-raspbian-on-raspberry-pi/) for more information.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 3/122
3/6/24, 6:29 AM Getting started with Scratch

When you use Scratch with this guide or one of our projects, you will need to switch between Scratch
and the project instructions.

Switch between browser tabs

Click on (or on a tablet, tap) the title of a browser tab to switch between the Scratch editor and project
instructions.

Side-by-side instructions and Scratch


If your screen is big enough, you can view Scratch next to the project instructions.

If you are using Microsoft Windows 10, drag the Scratch tab in your web browser so that it is in a
separate window, and keep dragging until the cursor reaches the right-hand edge of your screen. The
window will then be positioned on the right-hand side of the screen.

Now, drag the window containing this guide or your project instructions to the left-hand side of your
screen until the cursor reaches the left-hand edge. The window will take up the left half of your
screen.
You can resize the windows to get them just the way you want.
Tip: You can also hold down the Windows key and press the Left arrow key or Right arrow key to
position a window in the left or right half of your screen.
Try it now and see how you prefer to work.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 4/122
3/6/24, 6:29 AM Getting started with Scratch

When you are using Scratch in a web browser, you can zoom in or out to adjust the size.
For example, if you are using Microsoft Windows and you want to use zoom on a webpage in Google
Chrome or Microsoft Edge, hold down the Ctrl key and press the + key or - key to zoom in or out.

Use zoom in the Code area


You can also use the zoom controls in the Code area in Scratch to change the size of the code blocks
in the Code area.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 5/122
3/6/24, 6:29 AM Getting started with Scratch

Step 3 Set up a Scratch account

If you set up a Scratch account, you can save and keep all your Scratch projects online, and work on
them again in the future.
You can also share your projects and receive feedback, as well as comment on projects made by other
people in the Scratch community.

Create a Scratch account


Create a Scratch account
Go to scratch.mit.edu (https://scratch.mit.edu).
Click on Join Scratch in the menu.

A Join Scratch dialog box will open. Create a new username, and make sure that it is not your
real name. Then, create a strong password, with a mix of characters, numbers, and symbols.
Then, click on Next.

Choose the country you live in from the drop-down menu, then click on Next.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 6/122
3/6/24, 6:29 AM Getting started with Scratch

Select the month and year you were born. Then, click on Next

If you like, select your gender.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 7/122
3/6/24, 6:29 AM Getting started with Scratch

Type in your email address, or the email address of a parent.

Click on Create Your Account.


Click on Get Started.

At some point, you will need to go to your email inbox and confirm your email address.

If you are an educator, you can set up Teacher and Student Accounts.

Scratch Teacher Accounts


Please see the Scratch Teacher Account FAQ (https://scratch.mit.edu/educators/faq) for
information on setting up an account that gives educators additional features for managing student
participation on Scratch.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 8/122
3/6/24, 6:29 AM Getting started with Scratch

Step 4 The Scratch editor

The Stage is where the action takes place in your project. The Stage has one or more background images called
backdrops.
Sprites are characters and objects that appear on the Stage. Sprites are given instructions using Scratch code
blocks. This is called programming.

Drag code blocks from the Blocks menu to the Code area to program your sprites and the Stage. Code blocks can
make a sprite move around, change the way that it looks, and play sounds.
Sprites can have multiple costumes. You can change the costume to change the appearance of a sprite. This can
be used for effects such as giving the appearance of walking.
A script is a series of blocks that are joined together to give instructions to the Stage or sprites. The Stage and
sprites can each have many different scripts.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 9/122
3/6/24, 6:29 AM Getting started with Scratch

Step 5 Your first Scratch project

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 10/122
3/6/24, 6:29 AM Getting started with Scratch

When you create a new Scratch project, it includes a cat sprite.


Drag blocks from the Blocks menu to the Code area to make the cat do something.
To try an example, drag a move block from the Motion blocks menu. The blocks are colour-coded to
help you find them.

You can click on blocks in the Code area to run them. Click on the move block and the cat will move.
Tip: If you are using Scratch on a tablet, you can tap an item to click on it.
Hat blocks run the blocks below them when a particular event happens. The when green flag
clicked block runs code when you click on the green flag above the Stage to run your project.

Drag a when green flag clicked block above the move block so that they snap together.

Your code should look like this:

when clicked

move 10 steps

Tip: Scratch blocks are colour-coded, so you will find the when green flag clicked block in the
Events blocks menu.

Now, click on the green flag above the Stage and the cat will move.

You can add more sprites to your project, and you can also add a backdrop.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 11/122
3/6/24, 6:29 AM Getting started with Scratch

Choose a sprite
In the Sprite list, click on Choose a Sprite to see the library of all Scratch sprites.

You can search for a sprite, or browse by category or theme. Click on a sprite to add it to your project.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 12/122
3/6/24, 6:29 AM Getting started with Scratch

Choose a backdrop
In the bottom right-hand corner of the Stage pane, click on Choose a Backdrop.

You can search for a backdrop, or browse by category or theme. Click on a backdrop to add to your
project.

Name and save your project


Go to File in the menu. If you have a Scratch account, click on Save now. If you do not have an
account, click on Save to your computer.

Click in the project name box and change the name to match your project.

If you share your project, then other people will also see this name, so make sure that it makes sense.

You have created your first Scratch project!


You are now ready to learn Scratch. We recommend that you start with our Introduction to Scratch (https://proje
cts.raspberrypi.org/en/raspberrypi/scratch-intro), Scratch: Module 1 (https://projects.raspberrypi.org/en/
raspberrypi/scratch-module-1) and/or
Look after yourself (https://projects.raspberrypi.org/en/raspberrypi/look-after-yourself) paths, which are
designed for beginners.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 13/122
3/6/24, 6:29 AM Getting started with Scratch

You can return to this guide if you need help using Scratch when you are working on our pathway projects or on
your own independent projects.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 14/122
3/6/24, 6:29 AM Getting started with Scratch

Step 6 Motion

Motion blocks allow you to move your sprite around the Stage.

Movement
The move block is the simplest way to ge started with moving a sprite:

move 10 steps

You can go to or glide to the mouse-pointer, a random position on the Stage (or your finger on a tablet), or
another sprite:

go to random position

glide 1 secs to random position

You can also go to or glide to a position given by x and y coordinates on the Stage.

go to x: 0 y: 0

glide 1 secs to x: 0 y: 0

Glide to an object and back


The glide blocks in Scratch can be used to move a sprite across the Stage.
A sprite can glide to a specific point (coordinates), a random postion, the mouse pointer, or to another
sprite.
Positon your sprites in their starting points then select the sprite that is going to glide:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 15/122
3/6/24, 6:29 AM Getting started with Scratch

Drag a glide (1) secs to x: y: block into the Code area but don’t attach it to any other blocks yet. This
block has the coordinates of the starting point and will be used later to make the sprite return:

glide 1 secs to x: -150 y: -80 your numbers will be different

Drag a glide (1) secs to (random position v) block into the Code area and add it to your code at the
point you want the sprite to move.
Click on the dropdown menu and select the name of the sprite you want to glide towards:

glide 1 secs to Cake

Finally, drag the glide (1) secs to x: y: block, that is already in the Code area, to your script to glide
back to the start:

glide 1 secs to Cake

glide 1 secs to x: -150 y: -80

Tip: When you drag a sprite on the Stage, the motion blocks that use x and y coordinates update in the Motion
blocks menu. The current x and y coordinates are show in the Sprite pane.
Rotation
You can also change the direction that a sprite is pointing in. This changes the direction that the sprite will
move in if you use a move block. It may also change the rotation of the sprite’s costume depending on the
rotation-style setting.

When you add a sprite, it will be facing right (90 degrees). You can change this in the Sprite pane or using code
blocks.
https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 16/122
3/6/24, 6:29 AM Getting started with Scratch

turn 15 degrees

turn 15 degrees

point in direction 90 Click on 90 and drag the arrow to change

point towards mouse-pointer

direction

set rotation style left-right or all-around or none

Sprite direction
The direction of a sprite controls how much it is rotated.

When you add a new sprite it points to the right which is a direction of 90 degrees.

Direction Degrees
Up 0
Right 90
Down 180
Left -90

You can change the direction of a sprite in the Sprite pane. Click on the direction number and move the arrow
that appears, or type a number.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 17/122
3/6/24, 6:29 AM Getting started with Scratch

You can also use the point in direction block:

The sprite’s direction is used by the move block. Changing the direction of a sprite may also change the rotation
of the sprite’s costume depending on the sprite’s rotation-style.
Stop a sprite going upside down
When you add a sprite, its rotation-style is set to all around. If you make the sprite point left (-90
degrees) then the sprite costume will go upside down when the sprite rotates!
Sometimes this is what you want, but if you have a sprite that moves left and right then you often want the
sprite to point left or right depending on the direction it is facing.
Click on the Left/Right icon in the middle to change the rotation style to left-right to stop a sprite turning
upside down:

There’s also a code block that you can use:


https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 18/122
3/6/24, 6:29 AM Getting started with Scratch

set rotation style left-right

Spin around
This code makes a sprite spin when the green flag is clicked:

when clicked

forever

turn 1 degrees

In a turn block within a forever loop, change the number of degrees to 1 and your sprite will appear to spin.
Tip: If you do not add a move block, your sprite will spin in the position that it is in.

Move in a circle
This code makes a sprite fly in a circle when the green flag is clicked:

when clicked

forever

move 1 steps

turn 1 degrees

Change the values in a move block and turn block within a forever loop to 1 and your sprite will appear to
move in a big circle.
Tip: If you want your sprite to always start in the centre of the Stage, you can add a go to x: 0 y: 0 block
before the forever block.
Bouncing
The if on edge, bounce block is really useful when you want to make a sprite bounce around and stay on the
Stage:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 19/122
3/6/24, 6:29 AM Getting started with Scratch

if on edge, bounce

See some of the ways in which you can get your sprite to bounce around:

Bounce across the Stage

This code makes a sprite bounce on the left-hand and right-hand edges of the Stage. Because the sprite
rotates horizontally, it appears to flip when it changes its direction when the green flag is clicked:

when clicked

point in direction 90

set rotation style left-right

forever

move 5 steps

if on edge, bounce

In this example, the point in direction block automatically points the sprite to the right (90 degrees) when
the green flag is clicked. If you change the number of degrees to -90, your sprite will point left.

Add a set rotation style block and select left-right in the drop-down menu, so that your sprite will
not flip upside down when it bounces on the edge of the Stage.
Tip: You can drag your sprite on the Stage to move it to the y (up–down) position that you want.

Bounce up and down the Stage


This code makes a sprite bounce up and down the Stage when the green flag is clicked:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 20/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

point in direction 0

set rotation style don't rotate

forever

move 5 steps

if on edge, bounce

Change the number of degrees in the point in direction block to 0 to make a sprite point upwards.

Add a set rotation style block and select don't rotate in the drop-down menu to stop your sprite
rotating, even when it bounces.
Tip: You can drag your sprite around the Stage to move it to the x (left–right) position that you want.
Bounce at an angle
This code makes a sprite appear to rotate randomly when the green flag is clicked:

when clicked

point in direction 45

set rotation style all around

forever

move 5 steps

if on edge, bounce

If your sprite moves at 45 degrees, you will find that it appears to bounce on the edge of the Stage at an angle.
Change the number of degrees in the point in direction block to 45 to make your sprite bounce all
around.
Add a set rotation style block and select all around in the drop-down menu, so that your sprite will
turn when it bounces on the edge of the Stage.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 21/122
3/6/24, 6:29 AM Getting started with Scratch

Using coordinates
You can also change and set the x and y coordinates and get their values to use in other blocks:

Scratch coordinates

Scratch coordinates
In Scratch, the coordinates x:0, y:0 mark the central position on the Stage.

A position like x:-200, y:-100 is towards the bottom left on the Stage, and a position like x:200, y:100 is
near the top right.

You can see this for yourself by adding the Xy-grid backdrop to your project.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 22/122
3/6/24, 6:29 AM Getting started with Scratch

change x by 10

set x to 0

change y by 10

set y to 0

x position

y position

I can't see any Motion blocks


If you have the Stage selected then you won’t see any Motion blocks, because the Stage can’t move.

Click on a sprite in the Sprite pane and then click on the Code tab to see the Motion blocks.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 23/122
3/6/24, 6:29 AM Getting started with Scratch

Step 7 Looks

Looks blocks control a sprite’s appearance on the Stage.

Sprites can communicate using Looks, through a say speech bubble, a think thought bubble, or through their
graphic effects.

Say and think

say for seconds

say

think for seconds

think

Use a speech bubble to communicate


Sprites can say and think to communicate.
The say () for () seconds and think () for () seconds blocks are used to say or think something
for a set amount of time.

when this sprite clicked

say Hello! for 2 seconds hide speech after 2 seconds

The sprite will show a speech bubble for two seconds when clicked.
Space talk: See inside (https://scratch.mit.edu/projects/485673032/editor)
Click on the sprites to see them communicate with speech and thought.
The say () and think () blocks are used to say or think something, until another message or an empty say
() or think () block replaces it.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 24/122
3/6/24, 6:29 AM Getting started with Scratch

Size
Set or change the size of your sprites.

change size by

set size to %

size

Set the size of your sprite


When you add a sprite to your project, its size is set to 100 percent. This may be too big or too small for your
project.
You can use code to set the size of a sprite. To do this, use a set size to block:

set size to 50 %

If you set the size of a sprite to 50 percent, it will be half as tall and half as wide. If you set the size of a sprite to
200 percent, it will be twice as tall and twice as wide.

To set the size of a sprite when the project is started, place a set size to block under a when green flag
clicked block:

when clicked

set size to 50 %

You can also quickly set the size of a sprite in the Size property in the Sprite pane below the Stage:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 25/122
3/6/24, 6:29 AM Getting started with Scratch

Graphic effects
Set or change a range of visual effects, such as colour, fisheye, whirl, pixelate, mosaic, brightness and ghost.

change color effect by

set color effect to

clear graphic effects

Use graphic effects


Rooster effects: See inside (https://scratch.mit.edu/projects/435730522/editor)
The set color effect to and change color effect by blocks both have drop-down menus in which
you can choose from a range of different graphic effects that can be used to change your sprite’s appearance:
color: from 0 to 199 (bigger numbers will wrap around, so 200 is the same as 0)
fisheye: 0 means no effect, bigger numbers cause a bigger ‘fisheye’ effect, and negative numbers cause a
reverse ‘fisheye’ effect
whirl: 0 means no effect, big numbers make a big whirl to the left, and big negative numbers make a big
whirl to the right
pixelate: 0 means no effect, and bigger numbers create more pixels
mosaic: 0 means no effect, and bigger or negative numbers affect the number of copies
brightness: 0 means no effect, numbers up to 100 make the sprite lighter, and negative numbers down
to -100 make the sprite darker
ghost: 0 means no effect, and numbers up to 100 make the sprite more transparent

Try to set the different effect values to see what each one does. Explore how different effect changes make
your sprite look.

set whirl effect to 100

set pixelate effect to 50

Tip: A color effect of 225 is the same as a color effect of 25, so you can keep changing the colour. For
other graphic effects, no other changes will be made after you reach the maximum or minimum number for the
effect.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 26/122
3/6/24, 6:29 AM Getting started with Scratch

forever

change color effect by 25

wait 0.5 seconds

Use the clear graphic effects block to start again. Clicking on the green flag also clears all graphic
effects.

To set a graphic effect for a sprite when the project is started, place a set graphic effect to block under a
when green flag clicked block:

when clicked

set ghost effect to 25

Tip: You can also set and change graphic effects for the Stage.
Costumes
To create an animation effect with your sprites, you can change their costumes.

switch costume to

next costume

costume number

Show the mood of a sprite with costumes


Abby thinks “Hmm”: See inside (https://scratch.mit.edu/projects/498767227/editor)
You can use switch costume to blocks before and after a say for, think for, play sound, or wait
block to make your character show their feelings.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 27/122
3/6/24, 6:29 AM Getting started with Scratch

switch costume to abby-a starting costume

wait 1 seconds

switch costume to abby-b show feelings

think Hmm... for 2 seconds

switch costume to abby-a back to starting costume

Tip: Make sure that you use a block that has a time value, not a start sound, say, or think block, otherwise,
you will not see the costume change.

Change looks to create an animation effect


Beating heart: See inside (https://scratch.mit.edu/projects/435725413/editor)
You can use the set size to or change size by blocks to create a pulsing effect, such as a beating heart.

Note: The set size to block sets the size to a specific value, while the change size by block changes the
value from what it was before, e.g. change size by 10 adds 10 to the value of the size.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 28/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

set size to 160 %

forever

change size by 40

wait 0.2 seconds

change size by 20

wait 0.2 seconds

change size by -20

wait 0.2 seconds

change size by -40

wait 0.2 seconds

This code uses a series of change size by and wait blocks to make the heart grow and shrink. Try to create
your own pulsing sprite.

You could also use the change graphic effect by block to create a sprite that continues to change its
appearance.

when clicked

change ghost effect by 75

wait 1 seconds

change ghost effect by -75

Note: If you use code that changes a graphic effect and then changes it back again, remember to use a wait
block in between the change graphic effect by blocks, otherwise, it will happen so fast that you won’t
see it!

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 29/122
3/6/24, 6:29 AM Getting started with Scratch

You can use a clear graphic effects block at any time to reset the effects:

clear graphic effects

Click to change and then change back

You can add actions that make a change to a sprite and then reverse them, such as growing, waiting, and then
shrinking.
Squash ball when clicked: See inside (https://scratch.mit.edu/projects/435723273/editor)
This code will grow a sprite, apply the fisheye effect for 0.5 seconds, and then return the sprite to its starting
appearance:

when this sprite clicked

set size to 110 %

set fisheye effect to 50

wait 0.5 seconds

set fisheye effect to 0

set size to 100 %

Animate sprite movement with costumes


Hedgehog walking: See inside (https://scratch.mit.edu/projects/499398615/editor)
You can use switch costume to and move blocks in a repeat loop to animate a moving character. Change
the time in the wait block to change the speed.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 30/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked switch between two costumes

repeat 20

switch costume to hedgehog-a

move 3 steps

wait 0.1 seconds

switch costume to hedgehog-b

move 3 steps

wait 0.1 seconds

Tip: If you want to use all the costumes that a sprite has, you can just use the next costume block in a loop.

Tip: Increase the number of steps in each move block to make the sprite go faster. Change the number in the
repeat loop to adjust the distance.

Tip: To make the sprite move backwards, you can use negative numbers, for example, move -3 steps. Or, you
can use a point in direction -90 block to change the sprite’s direction before the sprite moves (-90
points to the left).
Backdrops
You can use code to change the backdrop too.

switch backdrop to

next backdrop

backdrop number

Use backdrops to create pages or levels


You can use backdrops in a Scratch project to create different pages or levels.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 31/122
3/6/24, 6:29 AM Getting started with Scratch

Changing backdrop tutorial: See inside (https://scratch.mit.edu/projects/498966268/editor)


Click on the Stage pane and then the Backdrops tab to view the backdrops for your project. You can drag the
backdrops to reorder them.

There are lots of ways to move to the next backdrop. Choose one that works for your project.

when space key pressed

next backdrop

when stage clicked click on the Stage

next backdrop

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 32/122
3/6/24, 6:29 AM Getting started with Scratch

when this sprite clicked click on a sprite

next backdrop

when backdrop switches to page1

wait 5 seconds

next backdrop

Visibility
The show and hide blocks control the visibility of a sprite.

show

hide

Show and hide sprites on different backdrops


When you are creating a book, animation, presentation, or game with levels, some sprites should only show on
some backdrops.

Show and hide sprites on different backdrops: See inside (https://scratch.mit.edu/projects/499876704/e


ditor)
Click on the Stage or press the Space key to switch to the next backdrop.
Use show and hide blocks with the when backdrop switches to block to make sprites only show on the
backdrops where they belong.
The Beachball sprite:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 33/122
3/6/24, 6:29 AM Getting started with Scratch

when backdrop switches to Beach Rio

show

when backdrop switches to Soccer 2

hide

Set the backdrop when green flag clicked to make sure that sprites show or hide correctly on the first
backdrop:

when clicked

switch backdrop to Beach Rio

Tip: You can also make sprites show and hide when green flag clicked.
Layers
To change how your sprites appear in relation to each other, you can use layers.

go to front layer

go forward layers

Position sprites with layers


There are two ways to position your sprites into layers.
You can drag a sprite on the Stage to move it to the front layer:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 34/122
3/6/24, 6:29 AM Getting started with Scratch

Alternatively, you can use a go to front layer or go to back layer block to position a sprite.

If you want a sprite to always stay at the front or back, use a forever loop to make the sprite move back to
the correct layer if you accidentally move it:

when clicked

forever

go to front layer or back

Position sprites in many layers


Through the window with tree: See inside (https://scratch.mit.edu/projects/454188775/editor)
In the example, the Window frame sprite appears at the front and the Sun sprite appears at the back. The
Avery Walking and Tree sprites are each in their own layers between the Window frame sprite and the Sun
sprite.
Use the go backward 1 layers block to place a sprite one layer behind the sprite at the front:

when clicked

go to front layer

go backward 1 layers

Change the value in the go backward 1 layers block for each sprite, depending on where you want it to be
positioned in relation to other sprites:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 35/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

go to front layer

go backward 2 layers

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 36/122
3/6/24, 6:29 AM Getting started with Scratch

Step 8 Sound

To add sound to your project, use Sound blocks. For example, you can create a continuous background
soundtrack, or add sounds that play at regular intervals.

First, select a sound from the Sound Library, or record your own sound.

Add a sound to a sprite or the Stage

Select the sprite that you want to have the new sound, then select the Sounds tab. Each sprite starts with a
default sound:

Scratch has a library of sounds that you can add to your sprites. Click on the Choose a Sound icon to open the
Sound Library:

To play a sound, hold your mouse cursor (or your finger, if you are using a tablet) over the Play icon:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 37/122
3/6/24, 6:29 AM Getting started with Scratch

Click on any sound to add it to your sprite. You will be taken straight back to the Sounds tab and you will be able
to see the sound that you have just added:

If you switch to the Code tab and look at the Sound blocks menu, you will be able to select the new sound:

Tip: You can also add sounds to the Stage.


Record a sound
Select the sprite that you want to have the new recorded sound, then select the Sounds tab:

Go to the Choose a Sound menu and select the Record option:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 38/122
3/6/24, 6:29 AM Getting started with Scratch

When you are ready, click the Record button to start recording your sound:

Click the Stop recording button to stop recording your sound:

Your new recording will be shown. You can Re-record your sound if you are not happy with it.
Drag the orange circles to crop your sound; the part of the sound with a blue background (between the orange
circles) will be the part that is kept:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 39/122
3/6/24, 6:29 AM Getting started with Scratch

When you are happy with your recording, click the Save button. You will be taken straight back to the Sounds
tab and you will be able to see the sound that you have just added:

If you switch to the Code tab and look at the Sound blocks menu, you will be able to select the new sound:

Add code to run Sound blocks where you want sound in your project.

Add a long sound to create a continuous soundtrack


Click on the green flag to hear the sounds.
Radio soundtrack: See inside (https://scratch.mit.edu/projects/444581851/editor)

You can use a play sound until done block inside a forever loop. Once the sound has finished, the
forever loop makes the sound start again from the beginning.

This code uses a single long sound clip repeated as a soundtrack:

when clicked

forever

play sound Dance Snare Beat until done

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 40/122
3/6/24, 6:29 AM Getting started with Scratch

Note: When you choose a new sound, if you select the Loops category, Scratch will only show you the sounds
that are suitable for a single looping soundtrack.

Add a sequence of short sounds to create a continuous soundtrack


Click on the green flag to hear the sounds.
Champ performance: See inside (https://scratch.mit.edu/projects/444673165/editor)

Use a forever block to create a looped sound. You can:


Put a series of short sounds in a sequence, or
Use different instrument notes and effects

when clicked

forever

play sound Low Boing until done

play sound Low Boing until done

play sound Drum Buzz until done

play sound Pop until done

play sound Bird until done

play sound Bark until done

play sound Glug until done

Add sounds that play at regular intervals

Football sounds: See inside (https://scratch.mit.edu/projects/450870079/editor)


Click on the green flag to hear the sounds.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 41/122
3/6/24, 6:29 AM Getting started with Scratch

In this project, the Stage has code to play a sound at regular intervals:

when clicked

forever

wait 3 seconds

play sound Cheer until done

The Whistle sprite also plays a sound at regular intervals:

when this sprite clicked

forever

play sound Referee Whistle until done

wait 4 seconds

Add sounds that start to play at the same time


There are two Sound blocks with an important difference:
When you play sound until done, the sound will play all the way through. The next line of code in the
script will not run until the sound has finished playing.

When you start sound, the sound will play, but the next block will run immediately and will not wait for
the sound to finish playing first.
This means that if you had a series of start sound blocks, the sounds would all play almost at the same time,
layered on top of each other. The effect can be interesting and sometimes messy.
Have a play with it sometime!

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 42/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

start sound Meow

start sound Alien Creak2

start sound Boing

start sound Boom Cloud

start sound Baa

Once you have chosen your sounds, you may want to change the volume, pitch, or pan (so you hear the sound
from the left- or right-hand speaker).

Volume, pitch, and pan


Click on the green flag to hear the sounds.
Band practice: See inside (https://scratch.mit.edu/projects/451697380/editor)
The Drums sprite uses set volume to, set pitch effect to, and set pan left/right effect to
blocks to change the sound:

set volume to 80 %

set pitch effect to 50

set pan left/right effect to -100

play sound Drum Funky until done

You can set volume to a value from 0 (silent) to 100 (full volume). This is useful if you want some sounds
to play louder than others, or if you want a sprite to appear further away.
The pitch effect controls how high or low a sound is. Setting the pitch to a higher value also makes a
sound faster. You can set pitch effect to values between -360 (very low) and 360 (very high).
The pan left/right effect allows you to control whether a sound comes out of a left- or right-hand
speaker or headphone or both. You can set pan left/right effect to values from -100 (all sound
from the left) to 100 (all sound from the right).
You can also use the Text to Speech extension:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 43/122
3/6/24, 6:29 AM Getting started with Scratch

Make a sprite talk with the Text to Speech extension


Pico and Giga talk with the speech extension: See inside (https://scratch.mit.edu/projects/499373708/e
ditor)

Click on Add Extension:

Choose Text to Speech:

You will get a new Text to Speech blocks menu:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 44/122
3/6/24, 6:29 AM Getting started with Scratch

You can use the blocks in the Text to Speech blocks menu to make your sprites talk out loud.

You can make a sprite talk out loud when clicked:

when this sprite clicked

set voice to alto

set language to Spanish

speak Hola

You can even give your sprite a kitten voice!

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 45/122
3/6/24, 6:29 AM Getting started with Scratch

set voice to kitten

speak Cat gotta haz milk.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 46/122
3/6/24, 6:29 AM Getting started with Scratch

Step 9 Events

Blocks in the Events menu control when scripts are started.


Hat blocks run the blocks below them when a particular event happens. They are rounded at the top, like a hat, so
no blocks can go above them.

You can use:

when clicked run blocks when the green flag above the Stage is clicked

when this sprite clicked run the blocks when the sprite for this script is clicked

when stage clicked run the blocks when the stage is clicked

Tip: The when stage clicked block is only available when you are working in the Code area for the Stage.

If you are on a computer with a keyboard, you can use when key pressed:

when space key pressed change to number, letter or arrow keys

You can also use a when backdrop switches to block to start a script when the backdrop changes.

Use backdrops to create pages or levels


You can use backdrops in a Scratch project to create different pages or levels.
Changing backdrop tutorial: See inside (https://scratch.mit.edu/projects/498966268/editor)
Click on the Stage pane and then the Backdrops tab to view the backdrops for your project. You can drag the
backdrops to reorder them.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 47/122
3/6/24, 6:29 AM Getting started with Scratch

There are lots of ways to move to the next backdrop. Choose one that works for your project.

when space key pressed

next backdrop

when stage clicked click on the Stage

next backdrop

when this sprite clicked click on a sprite

next backdrop

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 48/122
3/6/24, 6:29 AM Getting started with Scratch

when backdrop switches to page1

wait 5 seconds

next backdrop

Show and hide sprites on different backdrops


When you are creating a book, animation, presentation, or game with levels, some sprites should only show on
some backdrops.
Show and hide sprites on different backdrops: See inside (https://scratch.mit.edu/projects/499876704/e
ditor)
Click on the Stage or press the Space key to switch to the next backdrop.
Use show and hide blocks with the when backdrop switches to block to make sprites only show on the
backdrops where they belong.
The Beachball sprite:

when backdrop switches to Beach Rio

show

when backdrop switches to Soccer 2

hide

Set the backdrop when green flag clicked to make sure that sprites show or hide correctly on the first
backdrop:

when clicked

switch backdrop to Beach Rio

Tip: You can also make sprites show and hide when green flag clicked.

The when > block has two versions:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 49/122
3/6/24, 6:29 AM Getting started with Scratch

when loudness > 10 run blocks when the microphone detects sound

when timer > 10 run blocks when the timer reaches 10 seconds

Run a script after a time delay


Time delay conversation: See inside (https://scratch.mit.edu/projects/499336065/editor)

You can make a script run a number of seconds after the green flag is clicked:

when clicked

wait 5 seconds change the delay

Add blocks underneath the wait block to run after the delay.
The last two blocks in the Events menu are broadcast blocks. You can use when i receive (message v)
to start a script when any sprite runs a matching broadcast (message v) block.

Broadcast a message in Scratch


A broadcast is a way of sending a message which can be heard by all sprites. Think of it like an announcement
made over a loudspeaker.
Broadcasting spells: Use the magic wand to click on the buttons and cast spells. What does each spell do to
the characters? See inside (https://scratch.mit.edu/projects/518413238/editor)
You can create a message to be broadcast. The message text can be anything you like, but it is useful to give
it a sensible description.
Find the broadcast block under Events
Select New Message in the drop-down menu.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 50/122
3/6/24, 6:29 AM Getting started with Scratch

Then type your message

Send a broadcast
You can decide when to broadcast your message. For example:

when this sprite clicked

broadcast shrink

when backdrop switches to level 1

broadcast start

Receive a broadcast
Sprite can react to a broadcast by using a when I receive block. Multiple sprites can respond when they
receive the same message.
You can add blocks below a when I receive block to tell the sprite(s) what to do when they receives the
message.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 51/122
3/6/24, 6:29 AM Getting started with Scratch

when I receive shrink

change size by -10 negative numbers decrease the size

when I receive start

go to x: 100 y: 50

show

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 52/122
3/6/24, 6:29 AM Getting started with Scratch

Step 10 Control

Control blocks control the order that blocks run in, including decisions (selection) and loops (repetition).

The wait block delays for a number of seconds before running the next block.

wait 1 seconds delay for 1 second

wait 0.1 seconds delay for one tenth of a second

Loops control how many time the code inside them runs.

repeat 4 run the blocks inside four time

forever run the blocks inside until stopped

Checking a condition with if inside a forever loop


In Scratch it’s often useful to run code blocks every time a condition becomes true.

You can do this by placing an if block inside a forever block. You will need to trigger the script, for example
with a when flag clicked or when I receieve block.
You can check for important conditions in a game:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 53/122
3/6/24, 6:29 AM Getting started with Scratch

forever

if touching color ? then

say Nooooo! for 2 seconds

go to Start

Or check use an operator with a variable value.

forever

if health < 5 then

say Warning! Low health for 2 seconds

Tip: You can stop a forever block by clicking the Stop button above the Stage, or by using the stop blocks.
There are three options for the stop block:

stop all stop all scripts in all sprites

stop this script

stop other scripts in sprite

The if...then and if...then...else blocks are used to make decisions about which code blocks to run
next. This is sometimes called selection. The if...then block checks a hexagonal-shaped condition and runs
the code blocks inside, if the condition is true. The if...then..else block has an additional section to run the
code blocks inside, if the condition is false.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 54/122
3/6/24, 6:29 AM Getting started with Scratch

if then

if then

else

Using if...then and if...then...else blocks


The blocks inside an if...then block will only run if the condition in the hexagonal input is true.

if then

There are lots of hexagonal shaped condition blocks in Scratch, including blocks in the Sensing and
Operators blocks menus.

touching mouse-pointer ?

touching color ?

= 50

If you want to run different blocks when the condition is false then use an if...then...else block instead:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 55/122
3/6/24, 6:29 AM Getting started with Scratch

if money > 9 then

hide

change money by -10

else

say You don't have enough for 2 seconds

You can build more complex checks by ‘nesting’ if...then and if...then...else blocks one inside the
other.
You can find hexagonal-shaped blocks to use as conditions in the Operators and Sensing blocks menus.
The wait until and repeat until blocks also use conditions:

wait until delay until the condition is true

repeat until repeat the blocks inside until the condtion is true

A clone is a copy of a sprite, it has the costumes, scripts and sounds held by the sprite it was cloned from at the
time of cloning. There are a number of blocks that can be used to clone sprites.

With the create clone of [myself v] block, a sprite can create a clone of itself or of another sprite in the
project.

create clone of myself clones the sprite that runs this block

create clone of Butterfly 1 clones another sprite in the project

The when I start as a clone hat block is used to trigger a new script once the clone has been created. The
clone will exist in the project until the delete this clone cap block is used.
Using the when I start as a clone hat block then including the create clone of [myself v] block in
the script underneath means it is also possible for clones to create other clones.
https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 56/122
3/6/24, 6:29 AM Getting started with Scratch

when I start as a clone the script that runs when the clone is created

delete this clone stops the clone's scripts and deletes it

There is a maximum number of clones a sprite can have at any point, at the time of writing this is 300.

Clones of clones

Clones: See inside (https://scratch.mit.edu/projects/567544298/editor)

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 57/122
3/6/24, 6:29 AM Getting started with Scratch

Step 11 Sensing

The blocks in the Sensing blocks menu are used to get user text input, detect conditions, and report on values in
your project.
There are several hexagonal Sensing blocks that you can use in Control blocks to make decisions and control
when blocks run.
The touching block has options for detecting whether the sprite that owns the script is touching the mouse
pointer (where you finger last touched on a tablet), the edge of the Stage, or another sprite:

touching mouse-pointer ?

touching edge ?

touching Sprite2 ?

There are blocks for detecting whether the sprite that owns the script is touching another colour (on the Stage or
another sprite), or whether a colour on this sprite is touching another colour.

touching color ?

color is touching ?

The key pressed block has options for number, letter, and arrow keys. You need a keyboard to be able to enter
keys. It detects whether the key is currently being pressed:

key space pressed?

The mouse down block detects whether the mouse is currently pressed, or the screen is being tapped or touched
on a touchscreen:

mouse down?

The ask and answer blocks are used to get text input from the user:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 58/122
3/6/24, 6:29 AM Getting started with Scratch

ask What's your name and wait

answer the text the the user typed

The ask block works with a keyboard or with a virtual on-screen keyboard on a tablet.
The answer block is a reporter block that reports a value and can be used as a variable.

Chat using ask and answer


You can use the ask and answer blocks from the Sensing blocks menu to have a conversation.

Add blocks to a script on the sprite that will ask a question:

ask Did you find everything you wanted today? and wait

if answer = yes then

say That's fantastic! for 2 seconds

else

say Maybe I should add more items to my shop for 2 seconds

Debug: Check that you have spelled the options correctly in your code and in your answer. It’s okay if you use
capital letters, so “Yes” and “YES” will match “yes”.

Add multiple questions to create a chatbot or non-player character that you can talk to.
Tip: If you hide the sprite that asks a question, then question will appear inside the input box instead of as a
speech bubble.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 59/122
3/6/24, 6:29 AM Getting started with Scratch

The Sensing blocks menu also contains several reporter blocks that can be used to get values:

distance to mouse-pointer

distance to Sprite2

You can detect the current position of the mouse-pointer (or the current or most recent position of your finger on a
tablet):

mouse x

mouse y

You can detect the loudness of sound from the microphone. A pop-up window will ask the user for permission to
use the microphone:

loudness

The timer starts counting when the project loads, and can be set back to 0 with reset timer:

timer

reset timer

You can also access reporters for the Stage and other sprites:

backdrop # of _stage_

x position of Sprite2

costume # of Sprite2

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 60/122
3/6/24, 6:29 AM Getting started with Scratch

There are reporters related to the date and time in the real world, in your local timezone:

current year hour, minute, ...

days since 2000

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 61/122
3/6/24, 6:29 AM Getting started with Scratch

Step 12 Operators

The Operators blocks are used to compare variables and values, do calculations with numbers, and work with
strings (text).
The hexagonal ‘Boolean’ blocks are used as conditions, and return true or false. These blocks can be used in
Control blocks with a hexagonal input.

Comparison operators:

> 50

< 50

= 50

Tip: When you use = with text you can mix upper and lower case letters, so < YES = yes > returns true.
There are maths operations:

You can choose random numbers between the smallest and largest number (including those numbers).

pick random 1 to 10 A number from 1 to 10

The and, or, and not operators can be used to combine conditions.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 62/122
3/6/24, 6:29 AM Getting started with Scratch

and

or

not

There are blocks for working with text strings:

join apple banana

letter 1 of apple

length of apple

apple contains a ?

Join text and variables in Scratch


You can use the join block from the Operators block to join text and variables to make longer strings.
Drag a join block into the block where you want to use it:

say join apple banana for 2 seconds

Replace the text with the text you want to use, or drag in a variable:

set name to Scratch

say join Hi, I'm name for 2 seconds

Tip: The join block doesn’t add spaces so you will need to type them.
You can drag a join block inside another join to create longer text strings:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 63/122
3/6/24, 6:29 AM Getting started with Scratch

say join Hi, I'm join name the cat for 2 seconds

Notice the ‘space’ at the end of Hi, I'm and the beginning of the cat.
There are also more maths operators that are useful for some projects.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 64/122
3/6/24, 6:29 AM Getting started with Scratch

Step 13 Variables

A variable is a way of storing numbers and/or text.


You can make your own variables and choose whether they show on the Stage:

Add a variable in Scratch

Click on Variables in the Code tab, then click on Make a Variable.

Type in the name of your variable. You can choose whether you would like your variable to be available to all
sprites, or to only this sprite. Press OK.

Once you have created the variable, it will be displayed on the Stage, or you can untick the variable in the
Scripts tab to hide it.

You should think about whether you need to set a starting value when you make a variable:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 65/122
3/6/24, 6:29 AM Getting started with Scratch

Make a variable and set a start value


Click on Variables in the Code tab, then click on Make a Variable.

Type in the name of your variable. You can choose whether you would like your variable to be available to all
sprites, or to only this sprite. Press OK.

The variable will show on the Stage:

If you want to hide the variable on the Stage, uncheck the box next to the variable in the Variables blocks
menu.
Setting a start value
If your variable should have the same starting value every time your project is run, then add a script to set it:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 66/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

set total to 0

You can rename a variable if you change your mind:

Rename a variable

Sometimes you think of a better name for a variable.


You can give a variable a new name: go to the Variables blocks menu, right-click (or on a tablet, tap and hold)
on the variable, and choose Rename variable.

This will change the name of the variable in all the blocks in which you have used it.

Tip: Make sure you know the difference between set and change by. set will replace the value stored in a
variable. change by will change the value of a number variable by the amount you choose, change by1 will add
one to a variable. change by-1 will take one away from a variable.
Tip: Variables on the Stage always appear in a layer above all of the sprites. If you have a moving sprite, the sprite
will go under any variables on the Stage.
You can use a slider to control the value in a variable.

Use a slider to set a variable


Right-click on your variable on the Stage.
Select slider in the menu.

Tip: On a tablet, double tap on the variable on the Stage to change between the display options.
Right-click again on the variable displayed on the Stage and select change slider range.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 67/122
3/6/24, 6:29 AM Getting started with Scratch

To set the range, specify a minimum and maximum value.


For example, a minimum of 1 and a maximum of 10 work fairly well for how quickly a sprite spins.

The value range that is right for your variable depends on what you are using it for. Sometimes you will need to
experiment a little to get it right, but remember that you can change it at any time.

Drag the slider to a convenient position on the Stage.


Tip: If you are using a computer with a keyboard, then you can use the arrow keys to change the value of a slider
by 1. First, click on the slider to select it, then use the Left arrow key to change the value by -1 and the Right
arrow key to change the value by 1.
More ideas for using variables:

Create a high score in Scratch


It’s fun to keep track of a high score in a game.
Let’s say you have a variable called score, which gets set to zero at the beginning of each game.
Add another variable called high score.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 68/122
3/6/24, 6:29 AM Getting started with Scratch

At the end of the game (or whenever you want to update the high score), you’ll need to check whether you have
a new high score.

Join text and variables in Scratch


You can use the join block from the Operators block to join text and variables to make longer strings.

Drag a join block into the block where you want to use it:

say join apple banana for 2 seconds

Replace the text with the text you want to use, or drag in a variable:

set name to Scratch

say join Hi, I'm name for 2 seconds

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 69/122
3/6/24, 6:29 AM Getting started with Scratch

Tip: The join block doesn’t add spaces so you will need to type them.
You can drag a join block inside another join to create longer text strings:

say join Hi, I'm join name the cat for 2 seconds

Notice the ‘space’ at the end of Hi, I'm and the beginning of the cat.

Set a variable with a button


Add a sprite to act as a button.

Tip: any sprite could be a button but there are already some button sprites in Scratch that you can use.

Click on the Variables Blocks menu and select the Make a Variable button.
Give the variable a name that is easy to recognise.

You will need to add code to your button sprite to update the variable. You could:
Use the button to set the variable to a new value.

when this sprite clicked

set speed to 10

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 70/122
3/6/24, 6:29 AM Getting started with Scratch

Use the button to change the existing value in a variable by a new amount.

when this sprite clicked

change score by 1

Use the button to ask a question and set the variable to the answer.

when this sprite clicked

ask What is your name? and wait

set name to answer

Change a variable in a loop


Loops can be used to repeat code blocks a set number of times, repeat until a condition is met, or run
forever.

Inserting a change block into a loop will change your variable each tim the loop runs.

The code below would accelerate a sprite gradually:

repeat 10

change speed by 1

move speed steps

The code below would increase a player’s score the longer they played the game:

forever

wait 10 seconds

change score by 1

The code below would keep running the loop adding 1 to the time variable until time = 50.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 71/122
3/6/24, 6:29 AM Getting started with Scratch

repeat until time = 50

wait 1 seconds

change time by 1

You can also use built in Scratch variables, such as size, costume number, volume and direction:

repeat 10

change size by 10

change costume number by 1

change volume by 5

change direction by -45

Control graphic effects with a variable slider


Here are some examples of how you can use your variable slider:
This example changes the ghost graphic effect so you can see through the rainbow.
Transparent rainbow: See inside (https://scratch.mit.edu/projects/451544795/editor)
You can use a transparent variable to control the ghost effect on a sprite at the front, and use it to reveal
or hide sprites in lower layers.

when clicked

go to front layer

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 72/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

forever

set ghost effect to transparent

Try using the same approach with other graphic effects such as brightness or color.
Control movement speed with a variable

Ladybug on a wall: See inside (https://scratch.mit.edu/projects/451545341/editor)


Use the speed variable as the input to a move block:

when clicked

forever

move speed steps

if on edge, bounce

Set the minimum and maximum values for the range of the slider to suit your project.

Control turn speed with a variable

Space dog: See inside (https://scratch.mit.edu/projects/451543041/editor)


Use an angle variable as the input to a turn right block:

when clicked

forever

turn angle degrees

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 73/122
3/6/24, 6:29 AM Getting started with Scratch

Change the delay in a wait block


Skeleton dance: See inside (https://scratch.mit.edu/projects/451536565/editor)
Use a delay variable as the input to a wait block:

when clicked

forever

wait delay seconds

next costume

A delay of more than one second is quite a long time. If you include a decimal number in the range of a slider,
then you can change the value by a 100th of a second at a time.
A range of 0.00 to 1.00 allows you to choose a delay between 0 seconds (no delay) and 1 second.

Change the numbers to get the minimum and maximum values that you want users to be able to use in your
project.

Change sound effects

Drum pitch: See inside (https://scratch.mit.edu/projects/451547017/editor)


You can use a variable in a set pitch effect to block. If you increase the pitch of a sound, the notes
get higher and the sound speeds up.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 74/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

forever

set pitch effect to beat

Play the sound in a separate forever loop, so that the pitch will change immediately, rather than waiting until
the sound has finished playing:

when clicked

forever

play sound Dance Head Nod until done

You can also use a variable to change the volume and pan (tilt) effect.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 75/122
3/6/24, 6:29 AM Getting started with Scratch

Step 14 My blocks

My blocks allow you to create new blocks for a sprite. You give the block a name and then define what the new
block does using other Scratch blocks. You can use your new block in any script on the sprite that owns the block.
This example defines a talk block that makes a sprite change costume:

Penguin chirps: See inside (https://scratch.mit.edu/projects/567554899/editor)

define talk

switch costume to penguin2-b

repeat 2

play sound chirp until done

switch costume to penguin2-a

when this sprite clicked

talk

when space key pressed

talk

You can use My blocks to organise your code. It’s simpler to group together all the blocks that make a sprite talk
and then just use one talk block when you want your sprite to talk.
If you decide that you want to change the way your sprite talks then you only have to change the code in one
place.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 76/122
3/6/24, 6:29 AM Getting started with Scratch

My blocks with inputs


You can also add inputs to My blocks so that they use the values you provide when you use the block.

Penguin talks: See inside (https://scratch.mit.edu/projects/567538874/editor)

define talk words

switch costume to penguin2-b

say words use the provided input

repeat 2

play sound chirp until done

say words

switch costume to penguin2-a

when this sprite clicked

talk hello

when space key pressed

talk hi

Making a block
Making a block
Click on My Blocks, and then click Make a Block.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 77/122
3/6/24, 6:29 AM Getting started with Scratch

Give your new block a name and then click OK.

You will see a new define block. Attach code to this block.

You can then use your new block just like any normal block.

The code attached to your new define block is run whenever the block is used.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 78/122
3/6/24, 6:29 AM Getting started with Scratch

Making a block with parameters


You can also create blocks that have ‘gaps’ for adding data. These ‘gaps’ are called ‘parameters’. To add
parameters, first make a new block, and then click on the options below to choose the type of data you want
to add. Then give your data a name, and click OK.

You will see a new define block as usual, except that this one contains the data gap you added and which
you gave a name.

You can then use your new block, filling in data in the gap.

As usual, the code attached to your new define block is run whenever the block is used.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 79/122
3/6/24, 6:29 AM Getting started with Scratch

Use My Blocks to organise code


The simplest way to use My Blocks is to help organise your code. Here is a simple example.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 80/122
3/6/24, 6:29 AM Getting started with Scratch

define move right

if not touching edge ? then

switch costume to right_1

change x by 2

switch costume to right_2

change x by 2

switch costume to right_3

change x by 2

define move left

if not touching edge ? then

switch costume to left_1

change x by -2

switch costume to left_2

change x by -2

switch costume to left_3

change x by -2

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 81/122
3/6/24, 6:29 AM Getting started with Scratch

when clicked

forever

if key right arrow pressed? then

move right

if key left arrow pressed? then

move left

My blocks are similar to ‘procedures’, ‘functions’ or ‘methods’ in other programming languages.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 82/122
3/6/24, 6:29 AM Getting started with Scratch

Step 15 Extensions

The extensions library allows you to add new blocks to the blocks menu with additional features.

Make a sprite talk with the Text to Speech extension


Pico and Giga talk with the speech extension: See inside (https://scratch.mit.edu/projects/499373708/e
ditor)
Click on Add Extension:

Choose Text to Speech:

You will get a new Text to Speech blocks menu:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 83/122
3/6/24, 6:29 AM Getting started with Scratch

You can use the blocks in the Text to Speech blocks menu to make your sprites talk out loud.

You can make a sprite talk out loud when clicked:

when this sprite clicked

set voice to alto

set language to Spanish

speak Hola

You can even give your sprite a kitten voice!

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 84/122
3/6/24, 6:29 AM Getting started with Scratch

set voice to kitten

speak Cat gotta haz milk.

How to add the Pen extension


To use the Pen blocks in Scratch, you need to add the Pen extension.

Click on the Add extension button in the bottom left-hand corner.

Click on the Pen extension to add it.

The Pen section then appears at the bottom of the blocks menu.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 85/122
3/6/24, 6:29 AM Getting started with Scratch

How to add the Music extension

To use the Music blocks in Scratch, you need to add the Music extension.
Click on the Add extension button in the bottom left-hand corner.

Click on the Music extension to add it.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 86/122
3/6/24, 6:29 AM Getting started with Scratch

The Music section then appears at the bottom of the blocks menu.

There are also Video Sensing and Translate extensions.

If you are using a Raspberry Pi computer then you can also use extensions for using electronics with the Raspberry
Pi (you will need extra components or a Sense Hat):

Adding the Simple Electronics extension to Scratch


Click on the Add Extension button in the bottom left-hand corner of the screen

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 87/122
3/6/24, 6:29 AM Getting started with Scratch

Choose the Raspberry Pi Simple Electronics extension from the list

How to add the Sense HAT extension


Click on the Add Extension button in the bottom left-hand corner of the screen

Choose the Raspberry Pi Sense HAT extension from the list

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 88/122
3/6/24, 6:29 AM Getting started with Scratch

Step 16 Paint editor

Use the Paint editor to create your own backdrops and costumes, and to edit existing backdrops and costumes.

Create a new backdrop in the Paint editor


Go to the Choose a Backdrop menu and click on Paint:

You will be taken to the Paint editor, where the new backdrop will be highlighted in the list. If you have other
backdrops in your project, you will also see them in the list.

To set the main colour of the backdrop, click on the Rectangle tool, then use the Fill colour chooser to select a
colour, then drag the shape over the full backdrop canvas:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 89/122
3/6/24, 6:29 AM Getting started with Scratch

If you want to add more details to your backdrop, you can use the Rectangle tool, Circle tool, or Brush tool, or a
combination of all three!

When you have finished, make sure that you give your new backdrop a name that makes sense:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 90/122
3/6/24, 6:29 AM Getting started with Scratch

Your new backdrop will be shown on the Stage and will be available to use in Looks blocks.

Create backdrops and sprites using shapes


You can create backdrops and costumes for sprites in the Paint editor, using just shapes.
Go to the Choose a Sprite or Choose a Backdrop menu and choose the Paint option:

Select which
tool(s) to use to
make the
shape(s) that
you want:

Circle: Click on
the Circle tool
to draw a
circle. Press
and hold the
Shift key on
your keyboard to draw a perfect circle.

Rectangle: Click on the Rectangle tool to draw a rectangle. Press and hold the Shift key to draw a square.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 91/122
3/6/24, 6:29 AM Getting started with Scratch

Triangle: Use the Rectangle tool to draw a rectangle or a square. Click on the Reshape tool and select the
corner that you want to remove. Click on the Delete tool to turn your shape into a triangle.

You can use the Fill tool to change the colour of a shape:

You may need to use the Forward and Backward tools to move your shapes forward or backward so that they
are positioned correctly within your image:

You can select all the shapes and Group them together so that you can adjust them or move them as one
shape:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 92/122
3/6/24, 6:29 AM Getting started with Scratch

Here is an example of a sprite created with the Circle and Rectangle tools:

Pig: See inside (https://scratch.mit.edu/projects/495903163/editor)


Remember to name the costumes and backdrops that you create in the Paint editor.
Use the Text tool
Click on the Fill colour chooser and select the colour that you want for your text:

Select the Text tool:

Click on the Paint editor and start typing.


Click on the Font drop-down menu and select the font that you want:

If you want to resize your text, click on the Select (Arrow) tool and select the text, then drag the corner handles
to resize the text:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 93/122
3/6/24, 6:29 AM Getting started with Scratch

If you want to change the Fill colour of your text, use the Fill colour chooser to select a colour, then select the
Fill (Bucket) tool and hold your mouse cursor over the text (or if you are using a tablet, tap the text). The text will
automatically change colour. Click on the text to make the change:

If you want each word in a message to be a different colour, size, and font, follow the process above for each
word in your message.
Position your text and/or group of words with the crosshair in the centre of the Paint editor:

To layer your words, use the Forward and Backward tools:

Add a costume to a sprite


Click on the Costumes tab and then on Choose a Costume to add any costume to the sprite from the Costume
Library:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 94/122
3/6/24, 6:29 AM Getting started with Scratch

You will need to position and resize the added costume in the Paint editor, to match the sprite’s other costumes.
Tip: If you position a sprite on the Stage and then change its costume, the sprite might appear to ‘jump’ or
change size. You will need to position and resize the costumes in the Paint editor so that they all appear in the
right position on the Stage.
Centre your costumes
Sprites rotate around their centre. You can see if your sprite is centred by looking at the small grey crosshair
shown in the Paint editor:

If the crosshair is not at the centre of your costume, you can use the Select tool to highlight the full costume. A
cross will then show in the centre of your highlighted costume:

You can drag the highlighted costume so that the cross in the costume aligns with the crosshair:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 95/122
3/6/24, 6:29 AM Getting started with Scratch

Occasionally, you might want to choose a point to rotate around that is not the centre of the costume. In that
case, you can align your chosen costume rotation point with the crosshair in the Paint editor:

Copy parts between sprite costumes


Click on the Costumes tab for your sprite.
Tip: Duplicate the costume that you want to edit — so that you can still use the original costume if you need to.
To do this, right-click (or on a tablet, tap and hold) on the costume and choose duplicate. You will now have a
copy of the costume:

To remove any part of the costume that you do not need any more, click on the part to select it, then click on
Delete:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 96/122
3/6/24, 6:29 AM Getting started with Scratch

The duplicated costume with parts removed should look something like this:

Tip: If you make a mistake in the Paint editor, you can click on Undo:

Go to the costume with the part that you want to add and click on the part that you need, then click on Copy:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 97/122
3/6/24, 6:29 AM Getting started with Scratch

If you want to add a part from a costume that is not already shown in the Costumes tab, you need to add the
costume to your sprite first. Click on the Choose a Costume icon, then find the costume that you want and click
on it to add it to your sprite:

When you have copied the part that you need, go back to the duplicated costume and click on Paste. The
duplicated costume should now look something like this:

Now, switch to the Code tab. You will be able to use the new costume in your code blocks:

switch costume to nano-a2 the edited costume

Duplicate and edit a costume to use in an animation


Some Scratch sprites just have one costume, or have multiple costumes that don’t work as an animation. If you
choose one costume, then duplicate it (make a copy of it) and make a small change, it can create an animation
effect.
Robot animation: See inside (https://scratch.mit.edu/projects/436260207/editor)
Switch to the Costumes tab for your sprite.
Choose the costume that you want to use, and delete the other costumes, because you will not need them for
your animation. For example, the Robot sprite comes with costumes for three different robots, so you should
choose one of the costumes and delete the other costumes.
https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 98/122
3/6/24, 6:29 AM Getting started with Scratch

Right-click (or on a tablet, tap and hold) on the costume, and choose duplicate.
Make small changes to the copy of the costume. For example, you can move, rotate, or change all or part of the
costume. You can also add movement lines.

If your costume uses vector graphics, then you can select parts of a costume and change each part separately.

You can duplicate the costume again and make more changes to add more frames to your animation.
You can now use your costumes in a simple sprite animation.

Use the Fill tool to change the colours in a costume


You can change the colour of your sprite. First, select your sprite in the Sprite list below the Stage and then click
on the Costumes tab.
Use the Select (Arrow) tool to highlight the part of the costume you want to change colour.

Go to the Fill colour chooser and select a colour. It will automatically fill the shape that you have selected.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 99/122
3/6/24, 6:29 AM Getting started with Scratch

Repeat the steps above for any part of the costume that you have missed, or for any other part of the costume
you want to change colour.

Use the tips below to help you to create your own designs for your sprites in the Paint editor.

Create scenery as sprites


Hill as a sprite: See inside (https://scratch.mit.edu/projects/452582516/editor)

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 100/122
3/6/24, 6:29 AM Getting started with Scratch

To make your own Hill sprite, shown in the example above, you can use the Circle and Rectangle tools in the
Paint editor:
Go to Choose a Sprite and select Paint to create a new sprite costume.

Choose a Fill colour. Click on Outline and deselect it (to do this, click on the box with the diagonal line in the
bottom left-hand corner of the menu). Now, use the Circle tool to draw an oval. Then, select the Rectangle
tool and draw a rectangle underneath the oval.
If you use varying colours for the shapes, you may need to use the Front and Back tools in the Paint editor
to move your shapes forward or backward so that they are positioned correctly within your background.
You can select all the shapes and Group them together so that you can adjust them or move them as one
shape.

Now, make other sprites for your scenery, if this fits in with your project idea.
Remember to name your sprite(s).
Use the Line tool to create a triangle
You can create polygons, such as a triangle, and use these shapes to create roofs or mountains.

Go to Choose a Sprite and select Paint to create a new sprite costume. In this example, you will make houses.
House: See inside (https://scratch.mit.edu/projects/453595663/editor)

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 101/122
3/6/24, 6:29 AM Getting started with Scratch

If you follow the instructions below, you can use the Line tool to create any shape:
Choose a Fill colour. To choose the colour black, decrease the Brightness to zero (0).

Select No outline.

Use the Rectangle tool to draw a rectangle.


Use the Line tool to draw a triangle. Make sure that you complete the triangle, otherwise it will not fill with
colour.
Move the two shapes together.
Select the Fill (Bucket) tool and fill the triangle with colour.
Use the Rectangle tool to draw another rectangle for the chimney.
You can use the Front and Back tools in the Paint editor to move your shapes forward or backward so that
they are positioned correctly. In this example, you will not need to do this, because the shapes are black to
make a silhouette.
Select all the shapes and Group them together so that you can adjust them or move them as one shape.
To create duplicate shapes of your house (for example, to make a skyline), follow the tips under Duplicate
shapes to create a scenery costume below.
Duplicate shapes to create a scenery costume
You may want to duplicate shapes within a costume so that your scenery appears busier or more crowded.
Multiple clouds: See inside (https://scratch.mit.edu/projects/447278432/editor)

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 102/122
3/6/24, 6:29 AM Getting started with Scratch

The effect of multiplying shapes is used by professional animators to create the impression of weather patterns,
such as rain or clouds; a cluster of objects, such as buildings or a wood; or a crowd of people in a scene.
To multiply any type of shape:
Go to Choose a Sprite and select, in this example, the Cloud sprite
In the Costumes tab, use the Select tool to highlight the whole of the shape
Use the Copy and Paste tools to create duplicates of the shape
Use the Select tool to move the shape within the Paint editor
You can vary the size of the shapes to help to create a greater sense of 3D effects, for example
You can select all the shapes and Group them together, so that you can adjust them or move them as one
shape

Use Saturation and Brightness to create depth


In the real world, objects that are further away appear lighter in colour. To achieve more realistic 3D scenery, you
can decrease the colour Saturation and/or Brightness of each sprite so that they appear further and further
away.

Create a sprite with gaps that you can see through


You can create a sprite that has gaps that you can see through. If it is positioned as the front layer and is the
size of the Stage, it can appear like a view through the bars of a cage or a window.
To create a type of masking sprite:
Go to Choose a Sprite and select Paint
Choose a Fill colour with no Outline and draw a vertical rectangle
Use the Copy and Paste tools to repeat this shape
Use the Select tool to move the shapes around
As you place your shapes, make sure that they are touching the edge of the Stage to fit in with your project
idea

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 103/122
3/6/24, 6:29 AM Getting started with Scratch

Tip: If you find it hard to manage the sprites on your Stage, such as having a large sprite that keeps covering a
much smaller one, you can click on Hide so that you don’t see a sprite or sprites. Then, when you have finished,
click on Show again.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 104/122
3/6/24, 6:29 AM Getting started with Scratch

Step 17 Sound Editor

Use the Sound editor to add and edit existing sounds, and to record your own sounds.

Creating sounds

Add a sound to a sprite or the Stage


Select the sprite that you want to have the new sound, then select the Sounds tab. Each sprite starts with a
default sound:

Scratch has a library of sounds that you can add to your sprites. Click on the Choose a Sound icon to open the
Sound Library:

To play a sound, hold your mouse cursor (or your finger, if you are using a tablet) over the Play icon:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 105/122
3/6/24, 6:29 AM Getting started with Scratch

Click on any sound to add it to your sprite. You will be taken straight back to the Sounds tab and you will be able
to see the sound that you have just added:

If you switch to the Code tab and look at the Sound blocks menu, you will be able to select the new sound:

Tip: You can also add sounds to the Stage.


Record a sound
Select the sprite that you want to have the new recorded sound, then select the Sounds tab:

Go to the Choose a Sound menu and select the Record option:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 106/122
3/6/24, 6:29 AM Getting started with Scratch

When you are ready, click the Record button to start recording your sound:

Click the Stop recording button to stop recording your sound:

Your new recording will be shown. You can Re-record your sound if you are not happy with it.
Drag the orange circles to crop your sound; the part of the sound with a blue background (between the orange
circles) will be the part that is kept:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 107/122
3/6/24, 6:29 AM Getting started with Scratch

When you are happy with your recording, click the Save button. You will be taken straight back to the Sounds
tab and you will be able to see the sound that you have just added:

If you switch to the Code tab and look at the Sound blocks menu, you will be able to select the new sound:

Editing sounds
Edit whole sounds or parts of sounds.

Reverse a sound
Reversing sounds are useful for creating special effects, for example the Slide whistle sound makes a good
shrinking effect, so reversing it makes the perfect growing effect!
Add or record a sound.
Click on the Reverse icon to make the sound play backwards. You will see the sound wave reverse.

Tip: To keep both the original version and the reversed version of the sound, right-click (or tap and hold) on the
original sound and choose ‘duplicate’.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 108/122
3/6/24, 6:29 AM Getting started with Scratch

Crop a sound
Select the sound to be edited.
Choose a starting position for your edited sound on the sound wave then left-click and hold. Drag your mouse
pointer to the new end position for your sound and release. You will see a highlighted area on the sound wave.
If you are using a tablet using your mouse or finger to tap and drag over the sound wave.

Use the sound editor tools to Copy, Copy to New, Paste or Delete the highlighted section of the sound.

Tip: You can use the Undo tool to reverse any changes you are not happy with.

Change sound effects

The sound editor has tools to change the speed, volume and fade effects of a sound - you can also make it
robotic!
To apply an effect to the whole sound click on a sound effect tool below the sound wave:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 109/122
3/6/24, 6:29 AM Getting started with Scratch

Click on the sound effect tools as many times as you like as each time it will apply the effect again.
To apply an effect to part of a sound, choose a starting position for your effect on the sound wave then left-click
and hold.

Drag your mouse pointer to the effect end position and release. You will see a highlighted area on the sound
wave.
If you are using a tablet using your mouse or finger to tap and drag over the sound wave.
Click on a sound effect tool. The sound wave will update and you can play your new sound:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 110/122
3/6/24, 6:29 AM Getting started with Scratch

Step 18 Debug

Debugging is finding and fixing mistakes in your code that are called bugs.
It’s easier to identify issues if you make one change at a time, and then run your program
It might take a few experiments for your project to work in the way that you planned

Here are some tips that can help you to debug a project when it is not doing what you want it to do:

Run smaller pieces of code


You do not have to run a whole program to check whether the last few new blocks that you have added work.
Click on a block in the Code area to run it — it is a quick way to check that a block is working as you expect it
to

To test a set of blocks on their own, drag them away from their containing script, click on them to test
them, then drag them back to the main script

Add temporary delays


Slow down the execution of your code when it is run. To do this, add a wait or wait until key pressed
block, then remove the block when you have finished debugging your code.

Show variables on the Stage

If your project uses variables to store data, then it can be helpful to show those variables on the Stage.
Click on the checkbox next to a variable in the Variables blocks menu to show or hide it on the Stage.
Does the variable always have the value that you expect?

Add comments
Add comments to blocks, sets of blocks, and/or scripts. Use everyday language to explain what the code does.
Sometimes, this will make you realise that your code does not actually do what you want it to do!
Comments are useful for when you want to understand your code later, and they help other people to
understand your projects.
There are common problems that lots of beginners (and experts!) experience in Scratch.

Debugging tips for specific problems

My sprite is going upside down — Add a set rotation style left-right or set rotation
style don't rotate block.

My sprite ‘jumps’ when it changes costume or bounces — Make sure that the costume is centred in the
Paint editor (line up the blue cross in the costume with the crosshair in the centre of the Paint editor).

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 111/122
3/6/24, 6:29 AM Getting started with Scratch

My sprite stops when it gets to the edge of the Stage — Add an if on edge, bounce block.

My sound does not play — Have you added a block to play sound when the sprite is clicked? If you have
copied code from another sprite, you will need to add the sound to this sprite in the Sounds tab. Check the
volume on your computer or tablet, and make sure that you have not lowered the volume with code — try
set volume to 100.

Other sprites keep going in front of my sprite — Use a go to front layer block.

My sprite only moves/changes once — Put your code inside a forever block so that it keeps running.
My sprite does not change when I move a variable slider — Put your code inside a forever block so that
it keeps updating.
Tip: If you cannot find the problem after you have tried these techniques, then take a break or work on a different
part of your project. When you come back, you might find the bug straight away!

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 112/122
3/6/24, 6:29 AM Getting started with Scratch

Step 19 Editing tips

It’s useful to learn how to copy and delete code blocks, and duplicate sprites.
Tip: You can use Ctrl-z (hold down the Ctrl key and tap ‘z’) to undo lots of actions in Scratch. If you accidentally
delete a Sprite or other item, you can use Restore from the Edit menu to get it back.

You can delete code blocks you don’t need any more:

Deleting and restoring in Scratch


You can delete a block by right-clicking on it and selecting Delete Block from the menu.

To delete a group of blocks, left-click on the top block to be deleted and drag it to the Blocks menu. All blocks
underneath it will be deleted too.
To restore blocks you have deleted in error, right-click and select Undo from the menu.

You can also delete a sprite by clicking on the sprite’s Trash can in the Sprite pane.

To restore a sprite, including all of its code blocks, go to the Edit menu and select Restore Sprite

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 113/122
3/6/24, 6:29 AM Getting started with Scratch

Duplicating or copying code can save you time when making a project.

Duplicate blocks
Duplicate blocks or sets of blocks to reuse in a sprite’s program:

Go to the Code tab.


Right-click (or on a tablet, tap and hold) on the first block that you want to copy. It will select all the blocks
below it too.
Select Duplicate in the drop-down menu.

Drag the duplicated code where you want it to go.

Delete any blocks that you do not need.

Duplicate a sprite
Right-click (or on a tablet, tap and hold) on your first sprite in the Sprite list below the Stage:

Select duplicate. This will create a copy of your first sprite, with the suffix “2”:

Rename your sprite:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 114/122
3/6/24, 6:29 AM Getting started with Scratch

Your sprite’s name will change in the Sprite list:

Your second sprite has exactly the same code as your first sprite. Do not run the program until you have started
to change the second sprite’s code — you might not see the second sprite because it might be positioned
underneath the first sprite.
Create a new sprite and copy over all or some of the first sprite’s code.

Copy a sprite's code


In the bottom right-hand corner of the Sprite list, click on Choose a Sprite and select the sprite that you want to
add.
Click on the first sprite and go to its Code tab. Drag the code that is in the first sprite’s Code area to the image of
the second sprite in the Sprite list, then let go of the code to finish copying it to the second sprite. You may have
one script that starts with a when green flag clicked block, as well as another script that starts with when
this sprite clicked. Make sure that you copy all the code scripts that you have created.

Your second sprite will now have exactly the same code as your first sprite. Do not run the program until you
have started to change the second sprite’s code — you might not see the second sprite because it might be
positioned underneath the first sprite.
If you want to copy costumes, sprites, sounds, and scripts between projects, drag them into the Backpack.

Using the Scratch Backpack


You can use your Scratch Backpack to store costumes, sprites, sounds, and scripts that you want to copy
between projects.
You can only access your own Backpack, and you must be logged in to your Scratch account to use it.
To open your Backpack, click on the Backpack tab at the bottom of the screen.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 115/122
3/6/24, 6:29 AM Getting started with Scratch

To add a sprite to your Backpack, drag the sprite from the Sprite list to the Backpack. This will store the full
sprite in your Backpack, including all of its costumes, sounds, and scripts.

To add a backdrop to your Backpack, select the Stage pane and click on the Backdrops tab, then choose
the backdrop that you want and drag it to your Backpack.

To use an item in your Backpack in another project, open the project and drag the item from the Backpack to
the correct pane or tab.

To delete an item in your Backpack, find the item in the Backpack tab, then right-click (or on a tablet, tap
and hold) on the item and select delete.

You can hide your Backpack when you are not using it. To do this, click on the Backpack tab at the bottom
of the screen.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 116/122
3/6/24, 6:29 AM Getting started with Scratch

It’s always worth spending some time making sure you have followed best practices so your project is easy to
understand.

Best practices for Scratch projects


Name all sprites, costumes, sounds, variables, and messages sensibly. It’s much easier to understand
projects that use helpful names.
Fill in the Project Page with a good title, instructions, and notes so that users know how to use your project
and where you got ideas from.
Add short comments that explain what your code is doing.
Make sure your scripts are tidy in the Code tab. You can right-click and choose Clean up Blocks or arrange
the scripts in a way that makes sense to you. Try and put similar scripts together.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 117/122
3/6/24, 6:29 AM Getting started with Scratch

Step 20Share and comment

To let other people access your project, make your project public. You can also share your project’s
unique web address with other people.

Share your Scratch project

Please make sure that you do not share any personal information about yourself when sharing your
Scratch projects.
Give your Scratch project a name.

Click the Share button to make the project public.

If you like, you can add instructions in the Instructions box, to tell other people how to use your
project.

You can also fill in the Notes and Credits box: if you have made an original project, you can write
some short comments, or if you have remixed a project, you can credit the original creator.

Click the Copy Link button to get the link to your project. You can send this link to other people by
email or text, or on social media.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 118/122
3/6/24, 6:29 AM Getting started with Scratch

Scratch provides the ability to comment on your own and other people’s projects. If you do not want
to allow people to comment on your project, you should turn off commenting. To turn off commenting,
set the slider above the Comments box to Commenting off.

More on sharing your project's web address


Your project will always start in the position that you last saved it in, so make sure that you save
your project in the right starting position
When you click on See Project Page, the web address of your project will appear in the browser
bar:

Copy the web address and paste it into an email, or write down the web address and give it to the
person who you want to share the project with
Tip: You can access completed Scratch projects on a computer or mobile device.

What to put in Instructions and Notes and Credits


On the Project Page, you can fill in the Instructions to explain how to use your project, and complete
your project’s Notes and Credits.
In the Instructions box, tell people how to use your project:

Include all the instructions that the user needs to explore your project fully.
Make sure that your instructions are given step by step and are simple. Instructions are easier to
read if you write them in a list.
Include all the user interaction, such as clicking on the green flag to start, and which sprites to
click on.
Let the user know if the project includes sound, as they may need to wear headphones or turn the
volume up on their device.
In the Notes and Credits box:
Thank the people who created the projects that inspired you. You could even include the web
addresses of the projects.
Did you include images or sounds that were created by someone else? If so, credit the source(s)
in this box.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 119/122
3/6/24, 6:29 AM Getting started with Scratch

Give and receive feedback on projects.

Comments and feedback in Scratch


Scratch provides the ability to comment on your own and other people’s projects. If you do not want
to allow people to comment on your project, you should turn off commenting. To turn off commenting,
go to the Project Page and set the slider above the Comments box to Commenting off:

If you are happy and feel safe to allow people to write comments on your project, you can leave the
first comment:

If you think a comment or project is mean, insulting, too violent, or otherwise inappropriate, click the
Report button to let the Scratch Team know about it. To report a comment, click the Report button
above the comment. To report a project, click the Report button on the Project Page:

Read the Scratch Community Guidelines (https://scratch.mit.edu/community_guidelines) so


that you know how you and others can maintain a friendly and creative community.

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 120/122
3/6/24, 6:29 AM Getting started with Scratch

Step 21 Our Scratch projects

Our Scratch paths have six projects each, to help you learn different skills in Scratch, in order to create your own
projects independently.
You can return to this reference guide, Getting started with Scratch, whenever you need to remind yourself of the
skills you have learnt.
These projects can be completed on any computer or tablet that runs Scratch 3.
Beginner Scratch projects
If you are new to Scratch, start with our pathways for beginners:

Introduction to Scratch: sprites, Look after yourself (https://projects.ra


scripts, and loops (https://projects.ras spberrypi.org/en/pathways/look-after
pberrypi.org/en/pathways/scratch-int -yourself)
ro) Learn how to look after yourself and
In this introduction for beginners, you will others with Scratch projects to make you
learn how to add code, costumes, and laugh, relax, control, create, exercise, and
sounds to sprites as you make focus.
animations, a game, apps, and a story.

Scratch module 1 (https://projects.ras


pberrypi.org/en/pathways/scratch-m
odule-1)

Beyond the basics Scratch projects


If you already know about sprites, costumes, backdrops, and loops then try these projects:

More Scratch: broadcast, decisions, Scratch module 2 (https://projects.ras


and variables (https://projects.raspber pberrypi.org/en/pathways/scratch-m
rypi.org/en/pathways/more-scratch) odule-2)
More Scratch moves beyond the basics
introduced in Introduction to Scratch.
You will make apps, games, and
simulations using message broadcasting,
if..then and if..then..else decisions, and
variables.

Advanced Scratch projects


If you want to learn about lists, clones, and creating your own blocks, then try these projects:

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 121/122
3/6/24, 6:29 AM Getting started with Scratch

Further Scratch: clones, my blocks, Protect our planet (https://projects.ra


and boolean logic (https://projects.ras spberrypi.org/en/pathways/protect-o
pberrypi.org/en/pathways/further-scr ur-planet)
atch) Use Scratch to learn about our planet
Further Scratch moves beyond the skills and how to protect the environment for
introduced in Introduction to Scratch and future generations.
More Scratch. You will make apps, games,
computer-generated art, and simulations
using boolean logic, functions, clones,
and more. Scratch for social enterprise (https://p
rojects.raspberrypi.org/en/coderdojo/
scratch-for-social-enterprise)

Scratch module 3 (https://projects.ras


pberrypi.org/en/pathways/scratch-m
odule-3)

Scratch GPIO hardware projects for the Raspberry Pi


If you have a Raspberry Pi computer, then you can also try these projects. You will need additional electronic
components.

Physical computing with Scratch Physical computing with Scratch


path (https://projects.raspberrypi.or additional projects (https://projects.ra
g/en/pathways/physical-computing- spberrypi.org/en/projects?software%
with-scratch-and-the-raspberry-pi) 5B%5D=scratch&hardware%5B%5D=ra
spberry-pi)

Did you enjoy the Scratch guide? Have you spotted an issue? Please click the Send feedback button below and let
us know!

Published by Raspberry Pi Foundation (https://www.raspberrypi.org) under a Creative Commons


license (https://creativecommons.org/licenses/by-sa/4.0/).
View project & license on GitHub (https://github.com/RaspberryPiLearning/getting-started-scratch)

https://projects.raspberrypi.org/en/projects/getting-started-scratch/print 122/122

You might also like