0% found this document useful (0 votes)
43 views676 pages

Coding Games in Scratch

The document is an introduction to a DK eBook titled 'Computer Coding in Scratch for Kids', aimed at teaching children coding through engaging projects. It includes contributions from experts in the field and emphasizes the importance of coding as a skill for the future. The book features a variety of coding projects and is designed to be user-friendly with a focus on creativity and fun.

Uploaded by

somee8375
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)
43 views676 pages

Coding Games in Scratch

The document is an introduction to a DK eBook titled 'Computer Coding in Scratch for Kids', aimed at teaching children coding through engaging projects. It includes contributions from experts in the field and emphasizes the importance of coding as a skill for the future. The book features a variety of coding projects and is designed to be user-friendly with a focus on creativity and fun.

Uploaded by

somee8375
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

G a m

I N S C R A T C H

F O R K I D S
Due to the complex integration of images

and text, this DK eBook has been formatted

to retain the design of the print edition.

As a result,all elements arefixed in place,

but can easily be enlarged by using

the pinch-to-zoom function.

Forpreviewingor tated pages or spreads, please

lock screen ortation in your device first.

If you are previewing this eBook on a mobile

phone, portrait mode is ercommended.

If previewing on a tablet or larger display


,

landscape mode will allow you to see

facing pages at the same time (two page view).


C O M P U T E R C

G a m

I N S C R A T C H

F O R K I D S

OJNWOODCOCK

FOREWORDBY CAROL VORDERMAN


FIRST EDITION

DK UK DK INDIA

Senior editor Ben Morgan Project editor

Project ar t editor Laura Brim Project ar t editor

Editors L i z z i e D a v e, y As h w i n K h u r a n a , S t e v e S e t f o rd Editor S o no ioYas h i n g

Designers M a b e l C h a n , P e t e r R a d c l i f f e, Art editors Sanjay Chauha

S t e v We o o s n a m - S a v a g e Assistant art editor

Jacket design development manager Sophia MTT Senior DT P d e s i g n e r s

Jacket editor Claire Gell Senior managing editor

Producers, p r e - p r o d u c t i o n F r ancescW
a a rdell Managing art editor

Senior producers M a r y Slater P r e -production manager

Managing editors Paula R e g a n Jacket designer

Managing art editor Owen Pe yton Jones Managing jackets editor

Publisher Andrew Macintyre

A s s o c i a t e p u b l i s h i n g d i r e c to r L i z Wheeler

A r t d i r e c tor K a r en Self

Design directors Stuart Jackman

Publishing director Jonathan Metcalf

This edition published in 2024

Firs t p u b l i s h e d i n G r e a t B r i t a i n i n 2 0 1 5 b y

D o r l i n g K i ndersley Limited

D K , O n e E m b a s s y G a r d e n s , 8V i a d u c t G a r d e n s , Lo n d o n , S W 1 1 7 B W

The authorised representative in the EEA is

D o r l i n g K i n d e rsley Ve r l a g G m b H . A r n u l f s .t r1 2 4 , 8 0 6 3 6 M u n i c h , G e r m a n y

Copyright © 2015, 2019, 2024 Dorling K indersley Limited

A Penguin Random House Company

10 9 8 7 6 5 4 3 2 1

001–339453–J u n e / 2 0 2 4

A l l r i g h t s r e s e r ve d.

N o p a r t o f t h i s p u b l i c a t i o n m a y b e r e p ro d u c e d , s t o r e d i n o r i n t r o d u c e d i n t o a r e t r i e v a l

s y s t e m , o r t r a n s m i t t e d , i n a n y f o r m , o r b y a n y m e a n s ( e l e c t ro n i c , m e c h a n i c a l, p h o t o c o p y i n g,

r e c o r d i n g , o r o t h e r w i s e ) , w i t h o u t t h e p r i o r w r i t t e n p e r m i s s i o n o f t h e c o p y r i g h t o w n e. r

A C I P c a t a l o g u e r e c o r d f o r t h i s b o o k i s a v a i l a b l e f r o m t h e B r i t i s h L i b r a r .y

ISBN: 978-0-2416-5891-8

Printed a n d b o u n d i n C h i n a

w w w .d k . c o m

tshetkirhom
wbTsFedai

pihsdeirwfae™itlSrecCoiunc

snpl’DieKrtm
pealn–so

[Link]

nraetam
Lro

yst/irnolfnbina/iakutmaus
m
o/[Link].
C A R O L V O R D E R M A N M A ( C A NA TB ) , M B E ,
i s o n e o f B r i t a si ’n b e s t - l o v e dT V p r e s e n t e r s a n d

i s r e n o w n e d f o r h e r m a t h e m a t i c a l s k i l l s . S h e h a s h o s t e d n u m e r o u sT V s h o w s o n s c i e n c e a n d

technology, f r o m moT o r r o sw World


’ to How 2 , a n d w a s c o - h o s t o f C h a n n e ls 4 ’

2 6 y e a r s . A C a m b r i d g e U n i v e r s i t y e n g i n e e r i n g g ra d u a t e , s h e h a s a p a s s i o n f o r c o m m u n i c a t i n g

s c i e n c e a n d t e c h n o l o g, y a n d h a s a k e e n i n t e r e s t i n c o d i n g .

DRJONWOODCOCKMA
ON
OX
has a degree in physics from the University of Oxford and

a PhD in computational astrophysics from the University of London. He started coding at the

age of eight and has programmed all kinds of computers, from single- chip microcontrollers

to world-class supercomputers. His many projects include giant space simulations,research

in high-tech companies, and intelligent robots made from junk. Jon has a passion for science

and technology education, giving talks on space and running computer programming clubs

in schools. He has worked on numerous science and technology books as a contributor and

consultant, includings DK’ Computer Coding for Kids and Computer Coding Made Easy

series of coding workbooks.

CRAIG STEELE
i s a s p e c i a l i s t i n C o m p u t i n g S c i e n c e e d u c a t i o n w h o h e l p s p e o p l e d e ve l o p

d i g i t a l s k i l l s i n a f u n a n d c r e a t i ve e n v i r o n m e n t . H e i s a f o u n d e r o f Co d e r D o j o i n S c o t l a n d ,

w h i c h r u n s f r e e c o d i n g c l u b s f o r y o u n g p e o p l e . C ra i g h a s r u n d i g i t a l w o r k s h o p s w i t h t h e

R a s p b e r r y Pi Fo u n d a t i o n , G l a s g o w S c i e n c e C e n t r e , G l a s g o w S c h o o l o f A r t , B AAF, T a n d

t h e B B C m i c r o : b i t p r o j e c t . C r asi gf’ i r s t c o m p u t e r w a s a Z X S p e c t r u m .
14

Atmosphere

16

yTp e s o f g a m e

18

How coding works

G E T T I N G S TA R T E D

22

I n t r o d u c i n g S c r a tch

24

G etting Scratch

26

S cratch tour

STAR H U N T E R

30

How to build Star Hunter

Score 0
D O G ’ S D I N N E R

132 H o w t o b u i l d D os gD’ i n n e r

G L A C I E R R A C E

168 How to build Glacier Race

Ben Gems: 20 Countdown 11

Laura Gems: 13
t e e n a g e S t e v e J o b s a n d h i s f r i e n d S t e v e Wo z n i a k , w h o l a t e r f o u n d e d A p p l e

t o g e t h e r, c r e a t e d t h e a r c a d e g a m e B r e a k o u t .

T h e y s t a r t e d c o d i n g s i m p l y b e c a u s e t h e y e n j o y e d i t . T h e y h a d n o i d e a h o w f a r

i t w o u l d t a k e t h e m o r t h a t t h e c o m p a n i e s t h e y w e r e t o b u i l d w o u l d c h a n g e

t h e w o r l d . Yo u m i g h t b e t h e n e x t o n e l i k e t h e m . C o d i n g d o e s n ’ t h a v e t o

b e c o m e a c a r e e r, b u t i t ’s a n a m a z i n g s k i l l a n d c a n u n l o c k e x c i t i n g d o o r s t o

y o u r f u t u r e . O r y o u m i g h t j u s t w a n t t o p l a y a r o u n d w i t h c o d e f o r t h e f u n o f i t .

C o m p u t e r g a m e s o p e n u p w o r l d s o f i m a g i n a t i o n . T h e y r e a c h o u t a c r o s s

t h e i n t e r n e t a n d a l l o w u s t o p l a y t o g e t h e r. T h e y a r e p a c k e d w i t h c r e a t i v i t y,

f r o m m u s i c , s t o r i e s , a n d a r t t o i n g e n i o u s c o d i n g . A n d w e ’r e h o o k e d o n

t h e m : s o m u c h s o t h a t t h e g a m e s i n d u s t r y i s n o w w o r t h m o r e t h a n t h e

m o v i e i n d u s t r y. I t ’s h u g e .
a n d t h e l a n d s c a p e s.

B u t f i r s t y o u n e e d t o t a k e c o n t r o l o f y o u r c o m p u t e r. To t e l l a c o m p u t e r w h a t

t o d o , y o u n e e d t o s p e a k i t s l a n g u a g e a n d b e c o m e a p r o g r a m m e r ! T h a n k s t o

l a n g u a g e s l i k e S c r a t c h™ , i t ’s n e v e r b e e n e a s i e r. J u s t f o l l o w t h e s i m p l e s t e p s

i n t h i s b o o k t o b u i l d e a c h g a m e a n d y o u ’ l l s e e w h a t g o e s o n i n s i d e e a c h o n e .

F o l l o w t h e c h a p t e r s i n o r d e r, a n d y o u ’ l l p i c k u p t h e e s s e n t i a l s k i l l s y o u n e e d

t o d e s i g n a n d b u i l d y o u r v e r y o w n g a m e s .

C A R O LV O R D E R M A N
C o m p u t e r

g a m e s
a b o u t a l l t h e i n g r e d i e n t s t h a t m a ke u p

t h e g a m e a n d h o w t h e y m i x t o g e t h .e r

Characters

I n m o s t g a m e s , t h e p l a ye r u s e s a n o n - s c r e e n

c h a r a c t e r t o e n t e r t h e g a m e w o r l d . I t co u l d

a n a n i m a l , a p r i n c e s s , a r a c e c,a ro r e v e n j u s t

a s i m p l e b u b b l eoT. c r e a t e a s e n s e o f d a n g e r

or competition, such games usually also

h a v e e n e m y c h a r a c t e r s t h a t t h e p l a ye r h a s

t o d e f e a t o r e s c a p e f ro m .

T h e s e a r e t“ hvee ribns

such as running

objects, casting

The mechanics a

well-designed m

Objects

Nearly all games include objects, from stars and coins that

b o o s t h e a l t h o r s c o r e s t o k e ys t h a t u n l o c k d o o r s . N o t a l l

o b j e c t s a r e g o o d – s o m e g e t i n t h e p l a ye s r way,’ s a p t h e i r

h e a l t h , o r s t e a l t h e i r t r e a s u r e s . O b j e c t s c a n a l s o w o rk

t o g e t h e r t o c r e a te p u z z l e s f o r t h e p l ay e r t o s o l v e.
E v e r y game challenges the player to achieve some

k i n d o f g o a l , w h e t h e r ist w’ i n n i n g a r a c e , c o n q u e r i n g

a n e n e m, y b e a t i n g a h i g h s c o r e , o r s i m p l y s u r v i v i n g

for as long you can. Most games have lots of small

g o a l s , s u c h a s u n l o c k i n g d o o r s t o n e w l e ve l s o r

winning new vehicles or skills.

Controls

K e y b o a r d s , m i c e, j o y s t i c k s,

and motion sensors all make

good controllers. Games are

more fun when the player

feels in complete control

Difficulty level

o f t h e i r c h a r a c t ,e rs o t h e

A gam
s en’ o f u n i f si tt ’o o e a s y o r h a r d . M a n y g a m e s

controls should be easy to

m a k e t h e c h a l l e n g e s e a s y a t t h e s t a r t, w h i l e t h e

master and the computer

p l a y e r i s l e a r n i n g, a n d m o r e d i f f i c u l t l a t e r a s t h e i r

s h o u l d r e s p o n d i n s t a n t l. y

s k i l l s i m p r o ve . G e t t i n g t h e d i f f i c u l t y l e v e l j u s t r i g h t

is the key to making a great game.

G A M E D E S I G N

Playabili t y

G a m e s d o n ’t h a v e t o b e c o m p l i c a t e d t o m a k e

p e o p l e w a n t t o p l a y t h e m o ve r a n d o v e r a g a i n .

One of the first successful computer games

w a s a s i m p l e t e n n i s s i m u l a t o r c a l l e d [Link]

b a l l w a s a w h i t e s q u a r e a n d t h e r a cquets were

w h i t e l i n e s t h a t c o u l d o n l y m o ve u p a n d d o w n .

A l t h o u g h t h e r e w e re n o f a n c y g r a p h i c s, p e o p l e

loved Po n g b e c a u s e i t h a d g r e a t p l a yability. Th ey

c o u l d c o m p e t e a g a i n s t f r i e n d s, j u s t l i k e i n r e a l

t e n n i s , a n d i t w a s j u s t h a rd e n o u g h t o d e m a n d

intense concentration and a steady hand,

l e a v i n g p l a y e r s a l wa y s w a n t i n g a n o t h e r g a m e.

l eT l i n g s t o r i e s

A background story helps set the scene for

a g a m e a n d g i v e s m e a n i n g t o t h e p l ay es r ’

a c t i o n s . B l o c k b u s t e r g a m e s h a v e m ov i e - l i k e

plots with twists, but even simple games

can benefit from some kind of stor y if it

m a k e s p l a y e r s f e e l l i k e t h e y ’ re o n a m i s s i o n .

Thinking of a stor y also helps you give a

game a consistent theme.

Sound

Sounds can have a strong effect

on how we fee l. Changing the

tune can make the same scene

f e e l e x c i t i n g , s c a r, y o r e v e n s i l l, y

and a sudden noise after a quiet

The speed of

s p e l l c a n c a u s e a j o l t o f t e r r .o r

changes the

Modern games use realistic sound

excitement a

e f f e c t s t o m a k e p l ay e r s f e e l l i k e

I s t e’ a s y t o s t

t h e y ’ re i n s i d e t h e a c t i o n .

when you ca

think about

next, but wi

clock and fa

you can’t h e l p

under pressu

Colour scheme

uoY c a n c h a n g e t h e a t m o s p h e r e i n a g a m e

s i m p l y b y a l t e r i n g t h e c o l o u r s. B r i g h t b l u e ,

yellow, a n d g r e e n f e e l s w a r m a n d s u n n, y for

i n s t a n c e , w h i l e i c y b l u e s a n d w h i te f e e l w i n t r, y

a n d d a r k e r c o l o u r s m a k e a g a m e f e e l s p o o k. y
movements and adjust

the images to match,

a l l o w i n g t h e p l a y e r to

turn around and look in

any direction, just like in

t h e r e a l w o r l d. A s a r e s u l t,

Whereareyou?

O n e o f t h e e a s i e s t w a y s t o c reate

a t m o s p h e r e i s t o g i ve a g a m e a l o c a t i o n

b y a d d i n g a b a c k g r o u n d i m a [Link] a k e

the illusion more conv incing, make sure the

game’
s c h a r a c t e r s m a t c h t h e s e t t i n g – d o n’t

put race cars in the deep sea or unicorns in

o u t e r s p a c e , fo r i n s t a n c e .

△ △

Spooky forest Trop i c a l b e a c h

A d a r k f o r e s t i s t h e p e r fe c t s e t t i n g A s u n n y b e a c h c r e at e s a c a r n i v a l

f o r g h o s t s , gr i f f i n s , a n d w i t c h es. mood for the colourful steel drums.


W h e n y o u c a ’nt f i n d

a n o p p o n e n t t o p l a, y a

computer can challenge

y o u t o a g a m e o f c a r d s,

chess, or a million other

popular board games.

Racing

Racing games create the illusion of speed

by making the scener y scroll past the

p l a y se rv’i e w p o i n ot . Ts u c c e e d , y o u n e e d

t o l e a r n e a c h r a c e t r a c k i n s i d e o u t s o you

can start tricky manoeuvres in advance.

△ △

Sandbox Combat

S o m e g a m e s f o r ce p l a y e r s a l o n g a s e t p a t h , b u t N i m b l e f i n g e r wo r k i s v i t a l f o r g a m e s i n v o l v i n g c l o s e -

sandbox games are the opposite: they give you q u a r t e r s c o mbat. Th e k e y t o s u c c e s s i s k n o w i n g w h e n

complete freedom to ex p l o r e t h e g a m e w o r l d a t and how to use many d ifferent attac k and defence

y o u r o w n p a c e a n d c h o o s e d i f fe r e n t q u e s t s w i t h i n i t . m o v e s , f r o m s l a m s a n d s o m e r s a u l t s t o s p e c i a l p o w e r s.

Simulator

I f y o u w a n t a p u p p y b u t d o n ’t w a n t t h e b o t h e r o f f e e d i n g

a n d w a l k i n g i t , a v i r t u a l p e t m i g h t s u i t y o u . S i m u l at o r s a i m

t o r e - c r e a t e re a l - l i f e s i t u a t i o n s . S o m e a r e m o r e t h a n j u s t a

game: flight simulators are so accurate and realistic that

p r o f e s s i o n a l p i l o t s u s e t h e m f o r t r a i n i n g.

Puzzle

Sport

S o m e p e o p l e l o v e t o exercise their brains with

P l a y t h e g a m e o f y o u r c h o i ce a s y o u r f a vo u r i t e t e a m , s e t i n p u z z l e sT. h e r e a r e m a n y d i f f e r e n t t y p e s , f r o m

a r e a l i s t i c s t a d i u m w i t h r o a r i n g c ro w d s . S p o r t s g a m e s l e t c o l o u r fu l t i l e -matching games to number puzzles

you compete in famous tournaments such as the football a n d e s c a p e g a m e s , i n w h i c h y o u n e e d to u s e y o u r

Worl d Cup, w i t h t h e c o m p u t e r r e fe r e e e n s u r i n g f a i r p l ay. i m a g i n a t i o n t o f i n d y o u r w a y f r o m r o o m to r o o m .


t h e l e f t a n d r i g h t a r r o w keys.

Planning a game

Score 10

I m a g i n e y o u w a n t to c r e a t e a g a m e

i n w h i c h y o u f l y a p a r r o t ov e r a r i v e, r

c o l l e c t i n g a p p l e s a s t h e y d r i f t downstream

b u t a v o i d i n g a n a n g r y lion.o uY w o u l d

need to give the computer a separate set

of instructions for each object in the game:

the apple, the parrot, and the lion.

The player wins a

point each time the

parrot gets an apple.

T h e a p p l e d r i f t s d o w n s t r e am

o v e r a n d o v. e r It reappears on

the left if the parrot takes it.


Apple

J u m p t o t h e l e f t e d g e o f t h e s c r e e n .

uoY can’t s i m p l y t e l l t h e c o m p u ter

that the apple drifts down the river

R e p e a t t h e f o l l o w i n g s t e p s o v e r a n d o v e r a g a i n :

and vanishes when the parrot eats it.

Instead, you need to break down this

M o v e a b i t t o t h e r i g h t .
complicated task into a set of very

s i m p l e s t e p s a s s h o w n h e r e.

I f I g e t t o t h e r i g h t e d g e o f t h e s c r e e n t h e n

j u m p b a c k t o t h e l e f t e d g e .

I f I t o u c h t h e p a r r o t t h e n

a d d o n e t o t h e p a r r o t ’s s c o r e a n d

j u m p b a c k t o t h e l e f t e d g e .
m o v e a b i t t o t h e l e f t i f I c a n .

I f t h e p l a y e r p r e s s e s t h e r i g h t a r r o w t h e n

m o v e a b i t t o t h e r i g h t i f I c a n .

I f t h e p l a y e r p r e s s e s t h e s p a c e b a r t h e n

m o v e a l l t h e w a y t o t h e b o t t o m o f t h e s c r e e n t a k i n g a s e c o n d a n d

m o v e a l l t h e w a y b a c k t o t h e t o p t a k i n g a s e c o n d

▷ Lion

T h e l i o n i s t h e p l a y e sr e’ n e m y a n d c a n

end the game if the parrot touches it.

Programming languages

I t i s c o n t r o l l e d by a s i m p l e p r o g r a m .

The instructions on this page are in simple

E n g l i s h , b u t i f y o u w a n t e d to c r e a t e t h e g a m e

o n a c o m p u t e, ry o u w o u l d n e e d t o t ra n s l a t e

J u m p t o t h e m i d d l e o f t h e s c r e e n .

them into special words that the computer

c a n u n d e r s t a n d : a p r o g r a m m i n g l a n g u a g e.

R e p e a t t h e s e s t e p s i n t u r n :

W r i t i n g p r o gr a m s w i t h a p r o g r a m m i n g

l a n g u a g e i s c a l l e d c o d i n g o r p r o g ramming.

I f t h e p a r r o t i s t o m y l e f t t h e n

This book uses the programming language

Scratch, which is ideal for learning about

m o v e a b i t t o m y l e f t .

c o d i n g a n d g r e a t fo r m a k i n g g a m e s .

I f t h e p a r r o t i s t o m y r i g h t t h e n

m o v e a b i t t o m y r i g h t .

I f t h e p a r r o t t o u c h e s m e t h e n

s t o p t h e g a m e .
G e t t i n g

s t a r t e d
o b j e c t s , o r s p r i t e s, w i l l a p p e a r i n t h e g a m e . S c r a t c h h a s

a l a r g e l i b r a r y o f r e a d y - m a d e s p r i t e s to g e t y o u s t a r ted.

Sprites Code blocks

S p r i t e s a r e t h e t h i n g s t h a t m ov e a b o u t o r r e a c t i n Code is made of blocks that you can drag

t h e g a m eT. h e y c a n b e a n y t h i n g f r o m a n i m a l s a n d with a computer mouse and join together

p e o p l e t o p i z z a s o r s p a c e s h i puosY. c a n b r i n g e a c h like jigsaw pieces. Each block contains one

sprite to life on screen with a list of instructions i n s t r u c t i o n s o ist e’ a s y t o u n d e r s t a n d .

called code.

The cat sprite

when space key pressed

appears whenever

y o u s t a r t a new

move 20 steps

S c r a t c h p r o j e c t.

say Hello!

Worki n g t o g e t h e r

G a m e s a r e u s u a l l y m a d e u p o f s e v e ra l s p r i t e s w o r k i ng

Experimenting

t o g e t h ,e re a c h c o n t r o l l e d b y t h e i r o w n c o d e . Co d e

b l o c k s m a k e s p r i t e s m o v e a b o u t , c r a s h i n t o e a c h o t h ,e r

Scratch is all about exp

create sounds, and change colour or shape.

you’ve b u i l t a g a m e , si t e’ a

to it or change how it w

Some sprites act as

w i t h t h e c o doeY. u c a n s e

enemies to make a

your changes straight aw


game more difficult.

HELP!
c o d e b l o c k s t h a t y o u’ve

built.
o Tm a k e t h e s t a g e

fill your whole computer

screen, click the icon at

the top right.

Background image

The enemy dinosaur

sprite chases the

p l a y se rc ’a t s p r i t e .

Several sprites can be

on the stage at once.

Making sprites move

I n a t y p i c a l g a m e , t h e p l a ye r m o v e s o n e s p r i t e

and the other sprites are pro grammed to move

a u t o m a t i c a l l y . Th e c o d e b e l o w m a k e s t h e

dinosaur in this project chase the cat.

when clicked

forever

“Tf ho er e ve r ”

point towards Cat

block keeps

the sprite

move 15 steps

moving

endlessly.
Online Scratch

If you have a reliable internet connection,

you can run Scratch online in a browser

w i n d o w w i t h o u t d o w n l o a d i n g a n y thing.

uoY w i l l n e e d t o s e t u p a S c r a t c h a cc o u n t .

J o i n S c r a t c h Sign in

1 2

oT s e t u p t h e o n l i n e v e r s i o n , v i s i t t h e S c r a tc h w e b s i t e a t After you’vejoined the Scratch website,and


“Siclick
gnin”

[Link]

a n d J c l i“ c k o i n oSY. cur awt ci hl l” n e e d t o enter your username and password.s best


It ’ not to use your

s e t u p a n a c c o u n t w i t h a u s e r n a m e a n d p a s s w o [Link] real name as your username


atC.“the
Click
reate” top of the

g a m e s w i l l s t a y p r i v a t e u n l e s s yo u c l, i“ wcShare”
kh i c h w i l l screen to start a new project. If you use the online version

publish them on the web. of Scratch, you can access your projects from any computer
.

Offline Scratch

uoY c a n a l s o d o w n l o a d t h e S c r a t c h

program to you r computer so you can use

i t o f f l i n e Thi
. s i s p a r ticularly useful if your

internet connection is unreliable.

L a u n c h S c r a t c h
I n s t a l l S c ra t c h
2
1

D o u b l e - click the icon on the

[Link]/

For t h e o f f l i n e v e r s i o n o f S c r a tc h , g o t o

desktop and Scratch will

download

. Fol l o w t h e i n s t r u c t i o n s o n s c r e e n t o d o w n l o a d

o p e n , r e a d y f o r yo u t o

t h e i n s t a l l a t i o n f i l e s , t h e n d o u b l e - c l i c k t h e m . A f ter

b e g i n p r o g r a m m i n g.

i n s t a l l a t i o n , a S c r a t c h i c o n w i l l a p p e a r o n y o u r d e s k t o p.

There’
s no need to

c r e a t e a u s e r a c c o unt

if you use the offline

version of Scratch.
on Wi n d o w s a n d M a c c o m p u t e r s . I f yo u r

computer uses Ubuntu, try the online

version instead.

Vers i o n 2 . 0

Old and

I n o l d e r v e r s i o n s o f S c r a tc h , s u c h a s

Scratch 2.0, the stage is on the left

new versions

and the code area is on the right.

This book is based on

▾ ▾

File Edit Tips


?
S CTCH
RA

S c r a t c h 3 . 0 , t h e l a t e st

Scripts

Untitled

by abcd (unshared)

Motion

version at the time of

Looks

Sound

w r i t i n g T. h e p ro j e c t s

Pen

Data

in this book may not

move 10 steps

work with older turn 15 degrees

turn 15 degrees

versions of Scratch,

point in direction 90

so make sure


point towards

you have 3.0.

Sprites

Settings File Edit


S C TCH
RA

Costumes
Sounds
Code
Stage

Cat
1 backdrop

New backdrop:

Motion

Motion

move 10 steps

Looks

turn 15 degrees


turn 15 degrees
Vers i o n 3 . 0 Sound

Events

go to random position

T h i s v e r s i o n o f S c r at c h w a s r e l e a s e d i n

go to x: 0 y: 0

Control

2 0 1 9 . I t s f e a t u re s i n c l u d e “aEnx t e n s i o n ”

glide 1 secs to random position

Sensing

s e c t i o n c o n t a i n i n g n e w p r o g ra m m i n g

glide 1 secs to x: 0 y: 0

Operators

blocks; new and improved sprites; and

point in direction 90

Variables

a m o r e s o p h i s t i c a t e d s o u n d e d i t .o r An
point towards m o u s e -pointer

My Blocks

o p t i o n t o u s e h i g h - c o n t r a s t b l o c k co l o u r s

has also been introduced to make Scratch

more accessible to e v e r y one, including

Backpack

people with disabilities.


move 10 steps

Looks

turn 15 degrees

turn 15 degrees

Sound

Select these headings

t o r e v e a l d i f ferent

sets of blocks.

Events

go to random position

go to x: 0 y: 0

Control

glide 1 secs to random position

Sensing

glide 1 secs to x: 0 y: 0

Operators

S T A G E A R E A

B L O C K S C O D E
point in direction 90

Vari a b l e s

P A L E T T E A R E A

point towards m o u s e -pointer

S P R I T E S
My Blocks

L I S T

B A C K P A C K S T A G E I N F O

Scratch window

The stage and sprites list occupy the right

of the Scratch window


, while code -building

areas are on the left.


T he tabs above the

code area reveal other Scratchfeatures.

Blocks palette

Instruction blocks for making

code blocks appear on the

l e f t o f t h e S c r a t c h w i n d o. w

Drag the ones you want to

use to the code area.


C u r r e n t s p r i te

selected

S E T L A U N C H S P E E D W I T H T H E S L I D E R

P R E S S T H E L A U N C H E R T O F I R E

These code

blocks control the

Launcher sprite.

when clicked

set LaunchSpeed to 10

go to x: –200 y: –140

go to front laye r

forever

point towards m o u s e -pointer

Blocks snap

together – use

the mouse or your

x
Sprite Launcher

finger if using a

tablet to move

them around.

Show S ize 100

Zoom in on

the code

M onkey2 Launcher NumBananas1 Numbananas2

Selected Sprites list

sprite All the sprites used in your

p r o j e c t a p p e a r h e r e. Whe n

y o u s e l e c t a s p r i t e, i t s c o d e

appears in the code area.


H u n t e r
t o b e a t y o u r s core.

A I M O F T H E G A M E

The aim of this game is to collect as

many golden stars as you can. Use the

c a t t o c o l l e c t t h e s t a r s, b u t w a t c h o u t for

d e a d l y o c t o p u s e suoY.’ l l n e e d t o move

q u i c k l y t o s u c c e e [Link] e m a i n s p r i t e s

i n t h e g a m e a r e s h o w n b e l o w.

Cat

Move the cat around the

s c r e e n w i t h y o u r c o m p u ter

m o u s e o r y o u r f i n g e r i f y o ure’

using a tablet.

Octopuses

The octopuses patrol the seas

but they swim more slowly

than you. If you touch one,

is t g’ a m e o v e r !

Stars

These appear one at a time

i n r a n d o m p l a c e usoT. c h a s t a r

to score a point.
Use your computer mouse or

y o u r f i n g e r i f y o ur’e u s i n g a

tablet to move the cat around.


Costumes
Sounds
Code

Motion

Motion

move 10 steps

Drag your chosen


Looks

turn 15 degrees

blocks here to start


turn 15 degrees
Selecting the Sound

building some code.

buttons here
Events

go to random position

r e v e a l s d i f fe r e n t
go to x: 0 y: 0

Control

glide 1 secs to random position

sets of blocks.

Sensing

glide 1 secs to x: 0 y: 0

point towards m o u s e -pointer

Operators

point in direction 90

Variables

point towards m o u s e -pointer

Sprite S prite1

My Blocks

Show

Choose blocks

Sprite1

from the list

Backpack

on the left.

We’l l p r o g r a m t h e c a t t o m o v e w h e r e ve r t h e p l a y e r

m o v e s i t t o – u s i n g t h e m o u s e o n a co m p u t e r o r

t h e p l a y se rf ’i n g e r o n a t a b l e t . S e l e c tg t“h e o t o

r a n d o m p o s i t i ob nl o” c k a n d d r a g i t t o t h e m i d d l e

of the screen – the code area.

Choosemouseopr-m
fnoeitr

thedroTp-m
dhough
.uwnoen

e r ’ ewspecyfnigthemouse-

,thnistrucotinwil pneorti

go to m o u s e -pointer

wuosnailfgryoknriufgrer

. oactbenm
tl puetr

Some blocks include

a d r o p - down menu.

Select Control

to reveal the

The blue Motion

orange blocks.

b l o c k s c o n t r o l t h e way

s p r i t e s m o v e.
Now look at the top left

of the stage – you’ll see

Select the green

a green flag. S e l e c t t h i s

f l a g t o p l a. y

to run your code.

Settings File Edit Untitled Share S e e P r o j e c t Page Tuto r i a l s

S CTCH
RA

Costumes
Sounds
Code

Events

Motion

when c l i c ke d

Looks

when space key press e d

Sound

Events

when this sprite clicked

Control

when the backdrop switch es to background1

when clicked

forever

Sensing

when loudness > 10

go to mouse-pointer

Operators

when I recieve message1

Vari a b l e s

broadcast message1 x
Sprite Sprite1

My Blocks

Show S ize 100

broadcast message1 and wait

Sprite1

Backpack


M o v e y o u r m o u s e o r y o u r f i n g e r i f y o ure’
Well d o n e !

u s i n g a t a b l e t c o m p u t e r a n d w a t c h w h at

uoY h a v e c r e a te d y o u r f i r s t

h a p p e n s . I f y o u fo l l o w e d a l l t h e s t e p s , t h e

S c r a t c h p r o j e c t . L se ta’ d d

cat will move with the mouse-pointer (or

some more things to the

y o u r f i n g e r ) a r o u n d t h e s t a g e.

project to build a game.


Setting the scene

At the moment the stage is just a boring white

r e c t a n g l e . Le st c’ r e a t e s o m e a t m o s p h e re by

a d d i n g s c e n e r y a n d s o u n d e f f e c tosT. change

t h e s c e n e r ,y we a d d“ backdrop”
a i mage.

oT t h e r i g h t o f t h e s p r i t e s l i s t i s a

b u t t o n t o a d d a p i c t u r e f ro m t h e

b a c k d r o p l i b r a r. y C l i c k i t a n d l o o k f o r

“ U n d e r w a. t Se er l e2 c” t t h e i m a g e .

The backdrop will now fill the stage.

The backdrop is just

d e c o r a t i o n a n d d o e s ’tn

a f f e c t t h e s p r i t e s.

Select this icon

to open the

b a c k d r o p l i b r a r. y

Choose a Backdrop
Meow

0:85
of sounds.

uoY c a

Faste r S lower Lo u d e r S ofter Mute aFd e i n aFd e o u t Reverse R obot

sounds to the stage

as well as to sprites.

Press thi s i c o n

to choose a sound

f r o m t h e l i b r a r. y

S e l e c t t h e C o d e t a b a n d a d d t h e f o llowing

when

code to the cat sprite,but leave the old code

2 1

i n p l a c e a s y o u n e e d b o t h T. h e n e w c o d e

forever

r e p e a t s t h e b u b b l e s s o u n dT“. h e p l a y s o u nd

u n t i l d o nb el o” c k w a i t s f o r t h e s o u n d t o

play sound Bubbles

finish before le t t i n g i t s t a r t again. Run the

game to hear the sound effect.

E X P E R T T I P S

Loops

Blo

A loop is a section of code that

to

r e p e a t s o v e r a n d o v e r a g a i n The
.

“ f o r e v ebrl”o c k c r e a t e s a l o o p t h a t
when clicked

c a r r i e s o n f o r e ver, b u t o t h e r t y p e s

forever

o f l o o p s c a n r e p e a t a n a c t i o n a f i xed

number of times. Loops are very

play sound Bubbles

common in almost all computer

programming languages.
l i b r a r. y Lo o k “Of o cr t o p ua ns ”d Motion in the blocks

select it. p a l e t t eT. h e t w o M o t i o n

blocks used here make

theoctopusmoveeltand
f

right across the stage.

Click here

to open

Octopus

the sprites

The octopus

l i b r a r. y

sprite will

block repe

appear in your

sprites list.

Choose a Sprite

N o w r u n t h e c o d eT. h e o c t o p u s w i l l p a t r o l l e f t a n d

5 1 61

r i g h t , b u t y o u ’ l l n o t i c e si tu’ p s i d e d o w n h a l f t h e

t i om eY. u can fix this by changing the way the sprite

turns around when it changes direction. Choose

t h e b sl“u ee t r o t a t i o n s t y l e” block and add it to the

o c t o p su sc’o d e .

when clicked

forever

This block makes

move 10 steps

the octopus face

f o r w a rd.

if on edge, bounce

set rotation style left-right


d r o p - d o w n m e n u a n d c h .o o“Ca
s et ” edge

This code will help the octopus

Sensing blocks

Cat

detect the cat.

are pale blue.

Choose Control in the blocks palette

touching Cat
if

81

a g a i n , a n d a d sd“ tao p abl l o” c k t o

t h e m i d d l e o f t“ihf ethen”
b l o c k . Th i s

stop all

w i l l s t o p a l l a c t i o n i f t h e o c to p u s i s

touching the cat, ending the game.

N o w a d d t“ihf ethen”
b l o c k s y o u ’v e b u i l t

This block

91

t o t h e o c t o p su sm’ a i n c o d e , p l a c i n g i t

ends the game

when the
c a r e f u l l y a f t e r t h e b l u e M o t i o n b l o c k s. A l s o ,

sprites collide.

a d d“ wa a i t 0 . 5 s e c o n db se ”f o r e t h e l o o p.

Run the project and see what happens.

“T hw ea bi lt o” c k a d d s a

s l i g h t d e l a y b e f o re t h e

when clicked

o c t o p u s s t a r t s moving.

wait 0.5 seconds

forever

s “T ht eo p ab ll lo” c k o n l y

runs if the answer to

move 10 steps

the question in the

“ t o u c h i bn lgo” c k i s y e s .

if on edge, bounce

set rotation style left-right

touching Cat ?
if then

stop all
point in direction 13

Select this window

and type 35 to set the

when clicked

o c t o ps u s ’i z e t o 3 5 % .

wait 0.5 seconds

set size to 35 %

point in direction 90

This number tells the

o c t o p u s w h i c h d i r e c t ion

to set off in.

E X P E R T T I P S N o w w e c a n d u p l i c a t e o u r o c t o p u s t o c r e a te m o r e

e n e m i e s . R i g h t - c l i c k ( i f y o ure’ u s i n g a m o u s e ) o r

D i r e c t i ons

l o n g - p r e s s ( i f y o u’re u s i n g a t a b l e t ) o n t h e o c t o p u s

i n t h e s p r i t e s l i s t a n d c h do o“ s e u .p lCi coapt ei e” s o f

S c r a t c h u s e s d e g r e e s t o s e t d i r e c t i oonY. u

the Octopus sprite will appear in the sprites list,

c a n c h o o s e a n y n u m b e r f r o m – 1 7 9 ° to

named Octopus2 and Oc topus3. Each will have

180°. Negative numbers point sprites left;

a c o p y o f t h e f i r s t o c t o ps u s’ code.

p o s i t i v e n u m b e r s p o i n t t h e m r i g h t . Us e

0 ° t o g o u p a n d 1 8 0 ° t o g o s t r a i g h t d ow n .

Sprite Octopus

–90° moves a

0 °

Show

sprite straight

to the left.

– 9 0 ° 9 0 °
Cat

180° moves a

sprite straight

down.

1 8 0 °

This menu appears if you

right-click on a sprite.
when clicked

For m o r e v a r i e t, y l es t m’ a k e

52

one of the octopuses set off in

set size to 35 %

a r a n d o m d i r e c t i o noT. d o t h i s ,

w e u s e a g r ep“ ei nc k r a n d o m ”

point in direction pick random –179 to 180

b l o c k . Th i s i s S c r as t c ’h way of

r o l l i n g a d i c e t o g e n e ra t e a

wait 0.5 seconds

r a n d o m n u m b .e rC h o o s e

Operators in the blocks palette

forever

to find the block and add it to

t h e f i r s t o c t o p su sc’o d e . R u n

move 2 steps

the project a few times to see

t h e o c t o p u s c h o o s e d i f f e re n t

if on edge, bounce

s t a r t i n g directions.

set rotation style left-right

if touching Cat

stop all

E X P E R T T I P S

Random numbers

Why do so many games use dice?

Dice create surprises in a game

when c l i c ke d

b e c a u s e t h e y m a k e d i f f e r e nt t h i n g s

h a p p e n t o e a c h p l a y e. rA r a n d o m

say pick random 1 to 6

n u m b e r i s o n e y o u c a n’t p r e d i c t i n

advance, just like the roll of a dice.

uoY c a n g e t t h e c a t t o s a y a r a n d o m
This block picks a random

number from 1 to 6.

d i c e r o l l u s i n g t h i s s i m p l e c o d e.
Cat Octopus Octopus2 Octopus3

Star

A d d t h e f o l l ow i n g c o d e t o S [Link] s c o d e w i l l m a k e t h e s t a r

72

move to a random ne w l o c a t i o n w h e n e v e r t h e c a t t o u c h e s i t.

T h e g r e e n b l o c k s c re a t e r a n d o m n u m b e r s c a l l e d co o r d i n a t e s ,

which Scratch uses to pinpoint locations on the stage.

when clicked

forever

if touching Cat ? then

go to x: y: pick random –200 to 200

“T fhoe r e vbe l ro” c k r e p e a t s

the blocks inside it.

oT s e e t h e s t sa rc’o o r d i n a t e s c h a n g e w h e n i t

Star: x position

82

moves, choose Motion in the blocks palette and

p u t t i c k s “bxy p o s i t i oa“n y”d p o. s Ni toi own ”r u n

t h e g a m e : y o u ’ l l s e e t h e s t sa rx’ a n d y c o o r d i n a t e s

Star: y position

u p d a t e e a c h t i m e t h e c a t m a k e s i t m o ve . U n t i c k

both boxes before yo u c a r r y o n .


down or left. Ever y s p o t on the stage has

a unique pair of coordinates that can be

–240 081– 021–

used to send a sprite to that position.

The x axis is bigger than

the y axis and extends

from –240 to 240.

(x:–190, y:–150)

uoY c a n a d d a s o u n d e f f e c t t h a t p l a ys

w h e n t h e c a t t o u c h e s a s t .a rFirst

92

make sure the star is selected in the

sprites list, then go to the Sounds tab

a b o v e t h e b l o c k s p a l e t t e. S e l e c t t h e

speaker symbol to open the sound

l i b r a r y a n d c h o o“asF e i r y .d uN so wt ”

a d d t h e p si“n tka r t s o u nbdl o” c k t o

t h e s t sa rc’ o d e a n d c h o o“asF e i r y d u s t ”

I n s e r t s t“ ht ea r t s o u nb dl o” c k
in the drop- down list.

i n t o t h e S tsa re ’x i s t i n g c o d e ,

then use the drop-down menu

t o c h o o s e w h i c h s o u n d t o p l a. y

if touching Cat ? then

start sound Fairydust

go to x: y: pick random –200 to 200 pick random –150 to 150


o n t h e b u t t“oMn ake a aV. r i able”

Vari a b l e s

M a k ea Var i a b l e

Click here to

my variable

create a new

variable.

set m y va r i a b l e to 0

change my variable by 1

This option makes

the variable available

f o r e v e r y sprite.

o u’ Yl l s e e a s e t o f n e w b l o c k s a p p e ,a ri n c l u d i n g

23

o n e f o r t h e s c o r e. M a k e s u r e t h e b o x n e x t t o i t i s

t i c k e d t o m a k e t h e s c o r e a p p e a r o n t h e s t a g e.

Vari a b l e s

M a k ea Var i a b l e

my variable

uoY c a n m o v e

t h e s c o r e d i s p l a y to

wherever you like.


Score

set m y va r i a b l e to 0

change my variable by 1
change Score by 1

start sound Fairydust

go to x: y: pick random –200 to 200

N o w c l i c k t h e g r e e n f l a g to

53

run the code and see what

happens when the cat

c o l l e c t s e a c h s t .a rS e e i f y o u

can collect 20 stars without

bumping into an octopus.

E X P E R T T I P S

Variables

A variable works like a box that you can store

information in, such as a number that can

change. In maths, we use letters for variables,

s u c h a s x a n d y . I n c o m p u t e r p r o g ramming,

w e g i v e v a r i a b l e s n a m e s s u c h “aSs core”
and

use them for storing not just numbers but

a n y k i n d o f i n f o rmation. rT y t o c h o o s e a

n a m e t h a t t e l l s y o u w h a t t h e v a r i a b l e i s f o, r

s u c h “aSsp e e“[Link]”core”
ost computer

l a n g u a g e s w o n’t l e t y o u p u t s p a c e s i n t h e

names of variables, so a good tip is to

c o m b i n e w o r d s. I n s t e a d o f u sdi n“ g o g s p, e e d ”

f o r i n s t a n c e , t y p“ De o g S p. e e d ”
when clicked

set size to 35 %

wait 0.5 seconds

forever

point towards Cat

This block starts

the chase.

move 5 steps

touching Cat ?
if then

stop all

Score

uoY c a n m a k e t h e g a m e g e t h a r d e r a s y o u p l ay.

83

Select the original octopus sprite and go to

Vari a b l e s i n t h e b l o c k s p a l e t t e . D r a g t“hScore”
e

move 2 steps

b l o c k i n t o t h e o c t o ps u s’“ move”
block. Now

t r y t h e g ame. Th e m o r e p o i n t s y o u g e t , t h e

faster the octopus swims.

move

If it gets too hard to o quickly, we can make things

93

more gradual. Choose Operators in the blocks

p a l e t t e a n d f i n d t h e s m a l l gdr e“e n ivide”


block.

R e a r r a n g e tm“hbove”
el o c k s o i t l o o k s l i k e t h e

i m a g e b e l o wyT. “p3e” i n t h e s e c o n d r o u n d w i n d o .w

move Score / 3 steps


turn 15 degrees

glide 3 secs to x: 0 y: –150

Sound

glide 3 secs to x: 200 y: 100

turn 15 degrees

glide 3 secs to x: –200 y: 100

Events

go to random position

Control

go to x: 0 y: 0

Sensing

glide 1 secs to random position

Operators

when clicked

glide 1 secs to x: 0 y: 0

set size to 35 %

Vari a b l e s

wait 0.5 seconds

point in direction 90

My Blocks
forever

point towards m o u s e -pointer touching Cat


if

stop all

Now run the project

14

and watch Octopus3.

It should swim in a

Score 0

repeating triangle

pattern.

oT c h a n g e t h e s h a p e

of the triangle, try

different number s in

g l tide”
“he b locks.

Debug Octopus2

I f O c t o p u s 2 ends up in the top-right cor ner at the end

o f a g a m e , i t c a n t r a p t h e p l a ye r i n t h e n e x t g a m e a n d

e n d i t t o o q u i c k Tl. yh i s i s a b u goT. f i x i t , y o u c o u l d d r a g

t h e o c t o p u s a w a y from the corner befo r e s t a r t ing, but

is t b’ e t t e r t o u s e c o d e t h a t m ov e s i t a u t o m a t i c ally. I n s e r t

g “ a obto”
l o c k a t t h e s t a r t o f t h e c o d e f o r O c to p u s 2 t o

send it to the centre of the stage.

Octopus2 can

trap the player

in the top-right

c o r n. e r

Add this block to make

Octopus2 star t in the

c e n t r e o f t h e s t a g e.

when clicked

go to x: 0 y: 0
Hey!u Tr n m e b a c k

into a cat!

Scuba diver

oT m a k e t h e u n d e r w a t e r t h e m e m o r e

Play with size

c o n v i n c i n g , r e p l a c e t h e c a t w i t h a d i ve.r

uoY c a n c h a n g e h o w e a s y t h e g a m e i s b y a d j u s t i n g

Select the cat in the spr ites list, then

the size of the sprites. Change the number in the

open the Costumes tab. Click on the

o c t o p u s be lsm“u’ bove”
el o c k s t o a l t e r t h e i r s p e e d .

sprite symbo l t o o p e n t h e l i b r a r, y

C h a n g e t h e p u r sp“ l eet s i z e bt ol o” c k s t o m a k e s p r i t e s

then find a diver costume.

l a r g e r o r s m a l l .e rF i n e - t u n e t h e n u m b e r s u n t i l t h e

game is just hard enough to be fun.

set size to 50 %

Swimming animation

when clicked

oT a d d a p r o f e s s i o n a l to u c h t o S t a r

Hunter, a n i m a t e t h e o c t o p u s e s s o
forever

t h e y l o o k l i k e t h e y ’ re s w i m m i n g .

next costume
Add this code to an empty part of

the code area for each octopus to

wait 0.1 seconds

make them switch between two

d i f f e r e n t p o s e s.
C h e e s e

C
monsters and collecting goodies.

A I M O F T H E G A M E

Mimi the mouse is hungr y and stuck in

a maze. Help her to find the cheese, but

a v o i d t h e e v i l b e e t l e s. A n d w a t c h o u t for

ghosts – the maze is haunted!

◁ Mimi

u o Y playthegameasthemouse.

Use the arrow keys on your

keyboard or your finger ifr yo’ue

using a tablet to make her run

either up, down, left, or right.

◁ Beetles

Beetles scuttle along the

edges and make random

turns when they hit a wall.

Ghosts

Ghosts can float through

walls. Th e y c a n a p p e a r

anywhere without warning

a n d t h e n d i s a p p e .a r
uoY c a n c r e a t e a

maze with any

pattern of walls.
a m o u s e ) o r l o n g - p r e s s i n g ( i f y o u’re u s i n g a and in the sprites list.

t a b l e t ) a n d s e l e cdt i “n. g elete”

x y
Sprite Sprite1 0 0

Show S ize 100 Direction 90

Click here to open

t h e s p r i t e s l i b r a r. y

Choose a Sprite

Sprite1

duplicate

export

delete

T h e p l a y e r m o ve s t h e m o u s e s p r i t e u s i n g t h e oT m a k e t h e s p r i t e l o o k m o r e l i k e a g a m e p a d , you

3 4

k e y b o a r d a r r o ws , o r ( i f t h e yre’ p l a y i n g o n a c a n c h a n g e t h e w a y i t l o o k s u s i n g S c r as tch’p a i n t

tablet) by touching a gamepad on the screen. e d i t .o rM a k e s u r e t h e G a m e p a d s p r i t e i s s e l e c ted

uoY c a n m a k e t h e g a m e p a d b y a d d i n g a n e w a n d t h e n c l i c k t h e C o s t u m e s t a b.

s p r i t e . S e l e c t t“Ch he o o s e a S p r i st ye m” b o l

a n d a d d t h e B u t t o n 1 s p r i t e f r o m t h e l i b rary.

C h a n g e t h e s p r si t e ’

n a m e to “Gamepad”

by updating the text

Code

in this box.

Sprite G amepad

S h ow S i ze 100

button1

84 x 84

Mouse1 G amepad
T h e s m a l l c i r c l e w i l l a l w ay s p o i n t i n

t h e d i r e c t i o n t h e p l a ye r t o u c h e sT. h i s

makes it easier to control the sprite.

Now select the Code tab and add this code to the Gamepad

6
sprite.
The gamepad will only appear when the player is touching

the screen. Run the code and move your finger around the game

area. Th e g a m e p a d b u t t o n w i l l a l w a ys p o i n t t o w a r d s t h e

d i r e c t i o n o f y o u r f i n g .e r

This block moves the gamepad

t o t h e b o t t o m l e f t o f t h e s c r e en

w h e n t h e g a m e s t a r t s.

when clicked

The ghost effect block

makes the gamepad

go to x: –175 y: –110

transparent so you can

see through it.

set ghost effect to 50

forever

When the player touc hes

the screen, the gamepad

hide

points in that direction.

point in direction 50

mouse down?

if
then

show

point towards m o u s e -pointer


Next, add these blocks of code to

key u p a r r ow

8
make the mouse sprite move up using

t h e a r r o w k e y o r t h e g a m e p a d . Th e

order is important so take your time.

S t a r t b y k e e p i n g t h e b l o c k s a p a r t.

Then check all the blocks are exactly

as they appear here.

direction of Gamepad > –35 direction

C o n n e c t t h e b l o c k s t o g e t h, e r

m a k i n g s u r e t h e o r d e r i s co r r e c t .

or

key u p a r r ow pressed? direction of Gamepad > –35

when clicked

forever

if

point in direction 0

move 5 steps
move 5 steps

key d o w n a r row pressed? or direction of Gamepad > 145 and

if

point in direction 180

move 5 steps

key r i g h t a r row pressed? or direction of Gamepad > 50 and direction

if

point in direction 90

move 5 steps

key l e f t a r row pressed? or direction of Gamepad > –125 d i r e c t i o na n d

if

point in direction –90

move 5 steps

Make sure the directions

are correct.

N o w p r e s s t h e g r e e n f l a g t o r u n t h e c o dueoY.

01
should be able to move Mimi in all directions

a r o u n d t h e s t a g e u s i n g t h e a r r ow k e y s o r t h e

g a m e p a d . I f si tn’ o t w o r k i n g , g o b a c k a n d

check all the steps.

The mouse sprite can now

move in all directions.

The gamepad will appear on

the bottom left when the

p l a y e r t o u c h e s t h e s c re e n .
Costume costume1

Fill

Copy Paste Delete Flip horizontal F

Paintbrus ht o o l

Straight line tool

Circle tool Rectangle tool

Convert t o V e c to r

[Link]

2 1

toolandchooseblackfromthecolourpalette

[Link]“Fi”lawinthetheoutlineofthecheese.

Ifyouwantper ectl
f ystraightlines,usetheline

ourcheese
[Link] drawingmightbetoobigat

first,[Link]
If your colour spills out and fills the

whole background, click on the

“undo” button. Make sure your lines

don’t h a v e a ny g a p s , t h e n t r y a g a i n .

The cheese is now ready to be added

to the game.

oT k e e p s c o r e , we n e e d t o c r e a t e a

Vari a b l e s

5 1

v a r i a b l e c a l. l“CeScore”
hd o o s e aV r i a b l e s

i n t h e b l o c k s p a l e t t e a n d s e l e“ Mc t a k e a

M a k ea Var i a b l e

TVari
. y pable”
e t h e w o“ rScore”
din the

p o p - u p b o x . S e l e c t t h e c h e c k b ox beside

my variable

t h i s n e w v a r i a b l e a n d t h e s c o r e c o unter

will now appear on the stage.

Score

Now add some code to make the cheese appear in a random

61

[Link] the mouse touches it, there noise,


willp“ be
op” a

when clicked

the player will score 10 points, and the cheese will move to a new

location. Run the code a n d t r y c a t c h i n g t h e c h e e s e . I t s h o u l d b e

set Score to 0

e a s y – b u t t h sa tb’ e c a u s e y o u h a v e n’t a d d e d e n e m i e s y e t . . .

forever

go to x: pick random –220 to 220 pick random –160 to 160 y:

wait until touching Mouse1 ?

change Score by 10

start sound pop

The code pauses here

until the mouse arrives.


when clicked

hide

set rotation style left-right

forever

point towards Mouse1

Choose a Sprite

Ghost

move 1 steps

Click here
The ghost

to open
is now your

if

touching Mouse1

t h e l i b r a r. y
selected sprite.

stop all

S t a r t s a new block

of code. Ghost will now

h a v e t w o co d e b l o c k s .

Now add a separate block of code to make the ghost

when clicked

91

a p p e a r a n d d i s a p p e a r f o r r a n d o m a m o u n t s o f t i m e.

This block keeps T“ hhide”


eb l o c k m a k e s t h e s p r i t e d i s a p p e ,a ra n d

forever

the ghost hidden

“ s h omwa” k e s i t a p p e a r a g a i n .

for 5–10 seconds.

hide

pick random 5 to 10
wait seconds

go to x: pick random –220 to 220 pick random –160 to 160 y:

show

pick random 3 to 6
wait seconds

This block keeps the ghost

o n s c r e e n f o r 3 – 6 s e co n d s .
The sound

repeats until

the game ends.

Now select the Sounds tab above the blocks palette.

C l i c k t h e s p e a k e r s y m b o l t o o p e n t h e s o u n d l i b r a r. y

12

S e l e c t t h e c a t e g o ,r“ Lot yhoepns ” c h o o s e t h e m u s i c

“. XRyel op 1e ”a t t h e p r o c e s s t o l o“aDda n c e C e l e b r a t e”

into the game too.

This opens the

s o u n d l i b r a r. y

Choose a Sound

Return to the Code tab and change the selected

s o u n d f “.r p“oto
XyRop”
mluon1 ”t h e g a m e a n d t h i n k

a b o u t h o w i t f e e l s t o play. N e x t t r y t h e s o u“nDda n c e

Celebrate”
. Whi c h o n e i s b e t t e r ?

Click the triangle to

choose the sound.

forever

p l ay s o u n d yXl o 1 until done


paintbrush symbol in the sprites menu

a n d r e n a m e t h e s p. r “i Mt e aze”

Mouse1 G amepad

N o w y o u c a n s t a r t u s i n g t h e p a i n t e d i t .o rS e l e c t t h e

24

“ C o n v e r t t o B i t m ba pu”t t o n t o c h a n g e t h e m o d e .

Choose the line tool and set the line width to 20.

Then pick a dark colour for the maze walls.

Costume costume1

20

Fill

Choose a colour before

y o u s t a r t drawing.

Line tool

Draw the maze

in the empty

space here.

Convert t o V e c to r
Convert t o V e c to r

F i n a l ,l y we n e e d t o a d d s o m e c o d e t o m a k e

62 72

s u r e t h e m a z e i s a l w ay s i n t h e c e n t r e o f t h e

s t a g e s o si tf ’u l l y v i s i b l e Wit
. h the Maze sprite

selected, click on the Code tab and add the

f o l l o w i n g c o d e.

when clicked

go to x: 0 y: 0

A t t h e c e n t r e of

the stage, x is 0

and y is 0.
point in direction 90

the cheese.

This block makes

her face right.

uoY m i g h t n e e d t o f i n e - t u n e y o u r M a z e

03

c o s t u m e t o m a k e s u r e M i m i c a n f i t t h ro u g h

a l l t h e p a s s a g e s , w i t h e n o u g h r o o m to p a s s

h e r e n e m i e s ( w h i c h w er e’ g o i n g t o a d d

later).
o Ta l t e r t h e m a z e , s e l e c t t h e M a z e

s p r i t e a n d c l i c k t h e C o s t u m e s t a b. U s e

the eraser tool to remove wa l l s o r t h e

selection tool to move them.

I f y o u u s e t h e e r a s ,e rb e c a r e f u l n o t t o l e a ve a n y

13

flecks of paint behind as Mimi will stop if she hits

them. Check the corners of the maze for bumps

t h a t M i m i m i g h t g e t s t u c k o n a n d r e m o ve t h e m .

Remove bumps with

the eraser tool.


Score 30 High Score 96

Try d i f f e r e n t

colours to see

which one looks

best in the maze.

G A M E D E S I G N

Space in games

How the obstacles in a game are laid out

h a s a b i g e f f e c t o n h o w you play. A m a z e

Wall s r e s t r i c t

i s t h e p e r fe c t o b s t a c l e t o d e m o n s t ra t e t h i s .
movement.

△ △

Open space Closed-in space

T h e p l a y e r c a n m ov e i n a n y T h e p l a y e r i s fo r c e d t o m o v e i n a v e r y

direction most of the time. limited way. J u s t o n e e n e m y p a t r o l l i n g

A game like this needs fast- the corridors of this maze would make

moving enemies or lots of l i f e h a r dT. h e p l a y e r h a s to t h i n k a h e a d

enemies to make it challenging. t o a v o i d g e t t i n g t ra p p e d .


I n s e r t t h e b l o c k s f o u r t i m e s i n t o M i ms i ’

53

when clicked
m a i n c o d eoT. m a k e c o p i e s , r i g h t - c l i c k

( i f y o ure’ u s i n g a c o m p u t e r ) o r l o n g -

forever

p r e s s ( i f y o u’re u s i n g a t a b l e t ) o n t h e

n e w b l o c k s a n d s edl e“ c t u .p l i c a t e ”

if key u p a r r ow

P l a c e t h e d u p l i c a t e s a f te r e a c h

“move 5 s t ebp sl ”o c k .

point in direction 0

move 5 steps

if key d o w n a r row

point in direction 180

move 5 steps

touching Maze ? then


if

move –5 steps

if

key r i g h t a r row

point to direction 90

I n s e r t the new

move 5 steps

blocks four

times into the

m o su s ce o’ d e .

if

key l e f t a r row

point to direction -90

move 5 steps
I f M i ms it ’a i l o r p a w s t o u c h a w a l l w h e n s h e

t u r n s a r o u n d , s h e c a n g e t s t u c k We
. can fix

63

I f M i ms it a’ i l o v e r l a p s

t h i s b u g b y m a k i n g s o m e c h a n g e s t o M i ms i ’

the wall, she might

c o s t u m e i n t h e p a i n t e d i t .o r

stop moving.

Select Mo use1 inthespriteslistandclick

the Cost u m e s t a b a b o v e t h e b l o c k s p a l e t t e.

73

C h o o“Cos en v e r t t o B i t m a tp ”t h e b o t t o m ,

andthenusetheerasertooltotrimstaiMi
l. mi’

Costume mouse1-a

40

Fill

Convert to Vecto r
C l i c k t“Ch he o o s e a S p r i t e ”

93

symbol and select the Beetle

s p r i t e f r o m t h e l i b r a r. y

Run [Link]:thebeetle

14

alwaysturnsrightandendsupgoingorund

Beetle

The beetle is

inloWops.
eneedtochangethecod esothatthe

now your

beetleturnsleftorrightatorandom.
T make a

selected sprite.

r a n d o m c h o i c e , u s p“e i ac k r a n d obml ”o c k . D r

it to an empty part of the code ar

A d d t h e f o l l ow i n g c o d e t o s e t t h e b e es t l e’ size,

the second number to 2.

40

l o c a t i o n , a n d d i r e c t i o n . I t u s e “s f ao r e v leor o” p t o

m o v e t h e b e e t l e , a n d “iaf nthen”
block to make it

s t o p a n d t u r n r i g h t w h e n e v e r i t h i t s a wall.

uoY m a y n e e d t o c h a n g e

when clicked

these numbers if the

b e e t l e s t a r ts on a wall.

set size to 30 %

go to x: –130 y: 80

This block

makes the

point in direction 90

N o w d r a g tp“hi ec k r a n d obml o” c k i n t o

beetle reverse

42

and then turn


t h e f i r s t w i n d o w oe f “a n qual bto”
lock.

forever

right when it

T h e n d r a ge t“h e qual bto”


lock into an

hits a wall.

“ i f t h e n e l s e” block.

move 5 steps

touching Maze ? then


if

if

This block

move –5 steps

makes the

beetle

turn 90 degrees else

turn right.
R e m o v e t“ ht eu r n 9 0 d e g r e be sl o” c k f r o m t h e b e e tsl eo’ r i g i n a l c o d e a n d

44

p u t t“ihf et h e n e l bs el o” c k i n i t s p l a c e , a s b e l o .w R u n t h e p r o j e c t a n d

w a t c h w h a t h a p p e n s . C h e c k there’
s e n o u g h r o o m f o r M i m i to s q u e e z e

p a s t t h e b e e t l e . I f n o t , a d j u s t t h e m a z e i n t h e p a i n t e d i t .o r

when clicked

set size to 30 %

go to x: –130 y: 80

The blocks inside the

point in direction 90

“ i f t h e”n block run

only when the beetle

touches the maze.

forever

move 5 steps

touching Maze ? then


if

move –5 steps

pick random 1 to 2 = 1
if then

turn 90 degrees

else

turn 90 degrees
when clicked

set size to 30 %

go to x: –130 y: 80

point to direction 90

forever

move 5 steps

touching Maze ?
if
then

move –5 steps

if pick random 1 to 2 = 1

then

turn 90 degrees

else

turn 90 degrees

touching Mouse1
if

broadcast message 1

This block is found under

Events. It sends a message

when the beetle hits Mimi.


Sprite B eetle2

spritebyright-clickingorlong-pressingonit

48

(usecontrol-clickifyouworkonaMac)and

Show

dthen
.Makechoosi
“ threennew
uplgciate”

beet
These
les. wilallhavethesamecode.

Seewhathappenswhenyouruntheproject.

Sprite1

S ed l ue“pcl itc a t e ” to

create new beetles.

uoY’ l l n e e d to c h a n g e t h e n u m b e r s i ng t“h e o to”

b l o c k s f o r e a c h n e w b e e t l e s o t h e y d o ’nt a l l s t a r t

94

in the same place. Starting in different c o r n e r s

w o r k s q u i t e w e l l. E x p e r i m e n t !

Beetles start

in corners.

Score 30
c a l l“eHdi g h. SA c no er e”w b l o c k w i l l a p p e ,a r

a n d t h e h i g h s c o r e c o u n te r w i l l a p p e a r o n

New variable name:

the stage. Drag it where ver you like.

High Score

For a l l s p r i t e s

Now add an extra set of blocks to the Cheese

when clicked

15

s“pfrosi tree’ v leor o” p t o t e s t f o r a n e w h i g h s c o r e

e a c h t i m e t h e p l a y e r g a i n s p o i n t s. R u n t h e p r o j e c t

set size to 70 %

a n d s e e i f a n y o n e c a n b e a t y o u r h i g h s c o r e.

set Score to 0

forever

go to x: pick random –220 to 220 pick random –160 to 160 y:

wait until touching Mouse1 ?

change Score by 10

start sound pop

if Score > High Score

i“T fh tehbelno” c k t e s t s

set High Score to S c o re

whether the high score has

been beaten. If so, the score

b e c o m e s t h e n e w h i g h s c o r e.
.Usedinigt”oCrnvertto

,drawarectangl
Btmi aep”

Use the selection tool

andfilitwithadark t o e n l a r g e t h e t e x t.

.colNow
ourswitchto

.C“onvVer totctor”

Chooseabrightcolour

andusethetexttoolto

GAME

GAME
“ type
inthe
OVER!”

[Link]

OVER!

“SansfontSeri
toand
f ”

usetheselectiontool

tomakethetextlarge.

Convert to Bitmap

uoY don’t w a n t t h e

35

“ G A M E O V E sRign
!”

when clicked

to show until the

g a m e i s r e a l l y o v ,e r

hide

s o l se th’ i d e i t w i t h

some code. Switch

This places the

to the Code tab and

“GAME OVER!”

add these blocks.

signinth e m i d d l e .

Now add some

when I receive GameOver

54

code to make the

sprite appear when

go to x: 0 y: 0

t h e g a m e e noduYs.

can use the same

go to front laye r

message that stops

Mimi to trigger

show

This block ensures

this code.

other sprites are

behind the sign.


Play on

uoY n e e d t o p l a y t h e g a m e a l o t

to find out what works and what

c a n b e i m p r o v e d. G e t o t h e r p e o p l e

Jazz up the game with some sou

toouYplay
can
. adjust many

st“h tea r t s o u nbdl o” c k w h e n t h e g h o s

properties of the gameoyuun


lit

when the game ends, or when yo

aongi:autcoirngfhitrhetget g a m e

score. Th e r e a r e l o t s o f s o u n d s i n S

w h e r e t h e a b i l i t i e s o f t h e p l a ye r

l i b r a r y that you can experimen

a n d e n e m i e s a r e w e l l b a l a n c e d.

Twea k t i m i n g s

uoY m i g h t f i n d C h e e s e C h a s e h a r d e r

t h a n S t a r H u n otT.e mr a k e i t e a s i ,e r Add a power b o o s t t h a t h i d e s a l

you can make the beetles slowe r or the enemies for 10 seconds when

make the ghost appear for a shorter t h e m o u s e t o u c h e s i toT. d o t h i s ,

time.
o uY c a n a l s o s p e e d u p M i m i . F o r you would need to add a new spr

variety, t r y m a k i n g e a c h b e e t l e r u n and a message to trigger a hid

at a different s p e e d . s h o w c o d e b l o c k i n e a c h e n e m. y

Vani s h i n g c h e e s e

For a n e x t r a c h a l l e n g e , m a k e t h e c h e e s e s p e n d o n l y 1 0 s e co n d s o r

s o i n e a c h s p o t b e f o r e m o v i n g t o a n e w l o c a t i o n T. h i s w i l l f o r c e t h e

when clicked

p l a y e r t o m o ve f a s toT. d o t h i s , g i v e t h e c h e e s e a n e x t r a c o d e b l o c k

w i t h“ f ao r e v leor o” p c o n t a i n i n g“ waa i t 1 0 s e c o n db sl o” c k , f o l l o we d
forever

b y a c o p y o gf t“ h e obto”
lock from the main code.

wait 10 seconds

go to x: pick random –220 to 220 pick random –160 to 160 y:

This block picks a

random location

for the cheese.


P l a y e r s l i k e t o s e e a g a ms e ’
simply type them in the instructions box on

t h e p r o j e c t p a g eoY. u n e e d t o l o g i n t o a n

instructions clearly before they

online Scratch account to do this.

s t a r t p l a y i n g . H e r e a re three

w a y s o f i n c l u d i n g i n s t r u c t i o n s.

Cheese Chase

Instructions sprite

Score 30

uoY c a n u s e t h e p a i n t e d i t o r t o c r e ate

an Instructions spr ite in the same

way that you cre a t e d t h e G a m e O v e r

s p r i t e . G i v e i t t h e f o l l o w i n g co d e t o

show the sprite at the start of the

g a m e a n d t o h i d e i t o n c e t h e p l a yer

p r e s s e s a n y w h e re o n t h e s c r e e n .

0 0 0 1

when clicked

go to x: 0 y: 0

The Instructions sprite

go to front laye r

appears until you press

a n y w h e r e o n t h e s c re e n .

show

mouse down?
wait until

hide

A d d t“hwi sa i t u n tb il lo”c k

t o t h e s t a r t o f e v e r y other

s p rsi t ce ’o d e s o t h e y d o n ’t

s t a r t m o ving until the

when clicked

game begins.

set size to 35 %

mouse down?
wait until
which can turn a single sprite into

a n a r m y o f s i n i s t e r co p i e s .

A I M O F T H E G A M E

Move the blue circle around the screen

t o c o l l e c t t h e p a l e g re e n c i r c l e s, b u t

a v o i d t h e r e d o n e s t h a t m a r c h t o wards

y o u l i k e a z o m b i e a r [Link] s o l i d

green and solid red circles drop clones

o f t h e m s e l v e s a s t h e y r o a m a ro u n d .

Score more than 20 points to win and

go below –20 to lose.

Player

The player is the blue circle.

I f y o u d o ’nt k e e p m o v i n g

quickly, the enemy circle s

w i l l s o o n o v e r w helm you.

Friends

T h e f r i e n d l y c i r c l e s a re g r e e n .

W h e n y o u t o u c h o n e , you

s c o r e a p o i n t a n d t h e c i rc l e

disappears with a pop.

Enemies

S t e e r c l e a r o f t h e r e d e n e my

c i r c l eusoT. c h o n e a n d i t t a k e s

t h r e e p o i n t s o f f y o u r s c o r e , b e fore
T h e s o l i d g r e e n c i rc l e l a y s

vanishing with a clash of cymbals.


Clones of the solid red Clones of the solid green

c i r c l e c h a s e t h e p l a ye
.r c i r c l e c h a s e t h e p l a ye
.r
menu to paint a new sprite. Bitmap”
(bottom left).

Then choose blue in

the colour palette.

Paint

Select this icon to

paint a new sprite.

Choose the circle tool on the left and then

select a solid colour (rather than an outline)

a t t h e t o p o f t h e p a i n t e d i t .o r

C l i c k w i t h t h e m o u s e o r y o u r f i n g e r i f y o ure’

E X P E R T T I

using a tablet and drag to draw a circle. On

a c o m p u t ,e rh o l d i n g d o w n t h e s h i f t k e y w i l l

Resizing the circle

g i v e y o u a c i rc l e r a t h e r t h a n a n o v [Link] e c i r c l e

s h o u l d b e a b o u t t h e s i z e o f t h e c sa th’ e a d . If your circle is too big or

Whenyou’
re happy with thes circle’ size, delete
too small, you can change

t h e c a t s p r i t e . R e n a m e t h e n e w s p r “i tPe. l a y e r ”
its size by using the

“Select”

drag the cursor over the

sprite in the painting area.

A r o t a t i o n t o o l w i l l a p p e a. r

Look on the stage to compare the

size of your new sprite to the cat.


Select the Fr iends sprite and go to the

Costumes tab. C h o o s e g r e e n i n t h e

c o l o u r p a l e t t e . S e l e c t t “hFill”
teo o l a n d

click inside the blue circle to make it

turn green.

Repeat the steps

7 Sprite Enemies
x
20

for the Enemies

sprite, but col our

Show S ize 100

t h i s s p r i t e r e doY. u

should now have

t h r e e d i f f e re n t

c o l o u r e d s p r i t e s.

Player Friends Enemies

Instant player control

N o w a d d a s c o r e d i s p l ay a n d s o m e c o d e

t o m a k e t h e P l a y e r s p r i t e m o v e w h e re v e r

y o u m o v e i t to – j u s t l i k e i n S t a r H u n t e. r

Select the

8
New
Va r i a b l e

P l a y e r s p r i te,

cl ickVa r i a b l e s ,

and make a New variable name:

variable called

Score

. “Score” T h e n

tick this

v a r i a bs l ec’h e c k

For a l l s p r i t e s oF r t h i s s p r i t e o n l y

box to show

“Score”
on

Cancel OK

the stage.
S e l e c t t h e g r e e n Fr i e n d s s p r i t e .

forever

Add this code to make the

01

circle bounce around the stage

point in direction

with a random change of

d i r e c t i o n e v e r y 2 5 0 s t e ps.

repeat 25

move 10 steps

if on edge, bounce

Run the project and

w a t c h t h e g r e e n c ircle’
s

1 1

u n p r e d i c t a b l e j o u rney. The

Friends s p r i t e m o v e s 2 5 0

steps in 10-step jumps but it

doesn’t g e t s t u c k t o t h e w a l l s.

E X P E R T T I P S

A f t e r 2 5 0 s t e p s, t“hf eo r e v e r ”

Repeat loops
l o o p g o e s b a c k t o t h e s t a r t.

T h e s p r i t e c h a n g e s d i r e c t ion

uoY’ v e a l re a d y s e e n

randomly and sets off again.

“ f o r e v el or ”o p s t h a t

repeat a group of blocks

Random direction

nonstop.“reAp e al to”o p

changes happen

does a similar job, but it

e v e r y 250 steps.

only repeats the blocks

inside a fixed number of

t i m e s Thi
. s type of loop

is sometimes called a

“ f oloop,
r ” because it

for

repeats a c e r t ain

n u m b e r o f t i m e s The
.

example shown here

r e p e a t s a n a c t i o n f o ur

t i m e s t o d r a w a s q u a r e.
of the Fr i e n d s s p r i t e a f t e r

each 250-step movement.

create clone of my s e l f

Run the project. At each change of

31

d i r e c t i o n , t h e s p r i t e l e av e s a c o p y

o f i t s e l f – a c l o n eT. h e c l o n e s a r e ’nt

j u s t p i c t u r e s – t h e y a r e f u l l y wo r k i n g

c o p i e s o f t h e o r i g i n a l s p r i t e, a n d y o u

c a n g i v e t h e m t h e i r o w n i n s t r u c t ions.

New clones are controlled by

41

t“hwe h e n I s t a r t a s a c l o nb el ”o c k .

A d d t h e c o d e b e l o w to t h e F r i e n d s
All clones run thei

copy of this code.


s p r i t eT. h e c o d e t e l l s e a c h c l o n e

t o m o v e t o w a r d s t h e P l a y e r s p r i te

for 300 steps, after which the clone

when I start as a clone

is deleted and vanishes from the

stage. Th e c l o n e s m o v e o n e s te p

set ghost effect to 50

a t a t i m eT. h e y m o v e m o r e s l ow l y

than the original Fr iends sprite,

repeat 300

w h i c h m o v e s i n 1 0 - s t e p j u m p s.

point towards Player

move 1 steps

R u n t h e c o d e a n d w a t c h t h e g re e n

5 1

c l o n e s a d v a n c e s l o w l y t o wards the

P l a y e r s p r i t e. Don’t w o r r y – t h e y ’ re

the good guys!

delete this clone


running the project now – the change Score by 1

score should rise as you touch

start sound pop

green circles, which instantly

disappear with a pop.

delete this clone

P O P !

delete this clone

E X P E R T T I P S

Clones

Clones are useful any time you want lots S u c h l a n g u a g e s a r e c a ol l e“ d b j e c t o r i e n t e d ”

o f c o p i e s o f a s p r i t e . M a n y p r o g r a m m i ng l a n g u a g e s a n d i n c l u d e J a v a a n d C + + . I n S c r a tch,

languages let you make copies of things, but there are thre e orange blocks that contro l

they are often called objects rather than clones. clones, all found in the Control s e c t i o n .

create clone of my s e l f

delete this clone

△ △

T h i s b l o c k c r e a t e s a c l o n e o f t h e s p r i t eT. h e This block gets rid of the clone. All clones

clone is identical to the sprite and appears in the d i s a p p e a r f r o m t h e s t a g e w h e n a p r o j e c t s tops,

same position and facing the same direction, so l e a v i n g j u s t t h e o r i g i n a l s p r i t e.

you won’t b e a b l e t o s e e i t u n t i l i t m oves.

when I start as a clone

When a clone starts, it runs the code headed with

t h i s b l o c k . C l o n e s d o n ’t r u n t h e s p rs i t e’ main code, but

t h e y c a n r u n a l l o t h e r c o d e b l o c k s i n t h e s p rs i t e’ code

area, such as code blocks triggered by messages.


E n e m i e s s p r i t e , o n e a t a t i me.

Player
Friends

This makes copies of the code

in the Enemies sprite.

S e l e c t t h e E n e m i e s s p r i t e T. h e

81 Undo

code blocks you dragged and

dropped may be on top of one

Redo

a n o t hoT.e r e a r r a n g e t h e m ,

right-click (ifyou’
re using a mouse)
Clean up Blocks

o r l o n g - p r e s s ( i f y o u’re u s i n g

Add comment

a tablet) on the background

a n d s e l e“Cc lte a n u p B. l o c k s ”

Delete 19 Blocks

Now adjust the Enemies clone

change Score by –3

91
c o d e s o t h a t i t t a k e s p o i n t s a w ay

when the Player touches a red clone.

A l t e cr t“h e h a n g e S c o r e bb yl o” c k s o

it changes the score by –3 instead of

o+1.u Y r e a l l y w a n t t o a vo i d t h o s e

nasty red enemies!

Add a sound to tell the player that

02 start sound Cymbal

p o i n t s h a v e b e e n l o s t . Lo a d t h e

cymbal sound into the Enemies

s p r i t e b y s e l e c t i“Cyn gm b ianl ”t h e

s o u n d l i b r a r. y A l t e r t h e c o d e t o p l a y

“Cymba
, oYnot
. u’ l l ”pln”op”
ow hear

w h i c h t y p e o f c l o n e y o u ’v e t o u c h e d .

R u n t h e p r o j e c t . C h e c k t h a t y o u now

12

have both red and green clones,

and that touching a red clone takes

3 p o i n t s o f f y o u r s c o re.
I f t h e s c o r e i s g re a t e r t h a n 2 0 , y o u w i n , a n d

think Vi c to r y !

a t h o u g h t b u b b l e w i t h t h e w o“ r d Vi c t o r y ! ”

a p p e a r s . I f t h e s c o re i s l e s s t h a n – 2 0 , y o u

stop this script

l o s e , a n d t h e s p r i t e t h i n“ kDse f e a t ! ”

if Score

Victor y ! Defeat!

think Defeat!

stop this script

Score 21 Score -21

L I N G O

Comparison operators

E a r l i e r w e s a w h o w y o u c a n u“isfethen”
blocks W h e n w e a d d t h e s e “itfothen”
b l o c k s , t h e y c r e a te

to create true or false statements – also known s t a t e m e n t s t h a t a r e e i t h e r t r u e o r f a l s e . I n C i r c le

a s B o o l e a n e x p r e s s i o n s – t h a t l e a d t o different Wars, t h“i se m o r e t h a n” o p e r a t o r t e l l s y o u t h a t

o u t c o m e s . oF r e x a m p l e , i n S t a r H u n t e, “irf you’ve wo n t h e g a m e w h e n y o u s c o r e o v e r 2 0 .

t o u c h i n g c a t t h e n s t a r t sound Fa i r y d u s mt ”a k e s

a s o u n d p l a y o n l y w h e n t h e c a t g e t s a s t [Link]

if

can do the same thing with numbers by using

w h a t a r e c a l l e d c o m p a r i s o n o p e r at o r s :

think iV c t o r y !

stop this script

2 < 5 3 = 3 5 > 1

is less than e q u a l s is more than


oT add some competition to the

set Score to
game, you can include an on-screen

timer that shows players how long

reset timer

they take to complete a game.

forever

go to m o u s e -pointer

Gototheariables
V section and make a

24

variable
“ forTiallme”sprites
o Tshow
.

it on the stage, tick the box next to


if Score

the variable’
s block. Choose the Player

sprite. Select Sensing in the blocks

think Vi c to r y !

palette.
r“eset
Add timer”
to the Player’
s

code, just before


“forever”
the
loop.
stop this script

Gobacktoariables
V andsdrag
“ Time
et a

block”ot to the code and“tadd


i mto e r ”

it, making it the last instruc tion in the

foreverloop.

if Score

think Defeat!

B y c o p y i“ntgi m et or ” t h e v a r i a b l e

stop this script

52

“, eT aicme”
h trip around the loop will

now display the time on the stage.

But the moment the player wins or

l o s e s , t h e t i m e s t o p s b e i n g u p d a ted

set Ti m e

(the code is stopped) and the total

time it took to win or lose is shown.

Time 41.573

I think it must be

lunch time!

toT a l n u m b e r

of seconds

in the game.
Use black

f o r t h e t e x t.

“ Ft iol lo” l

Now select black from the palette as the

o Y u a r e t h e b l u e c i r c l e.

72

c o l o u r f o r t h e t e xt. Th e n c h o o s e t h e t e x t t o ol

a n d t y p e o u t t h e i n s t r u c t i o n s s h o w n h e r e.

Try t o t o u c h t h e f r i e n d l y g r e e n c i r c l e s .

Each one gives you 1 point.

Avoid t h e e n e m y r e d c i rcles.

“ e x tTto o” l

Each one you touch takes 3 points.

Score more than 20 to win.

I f t h e t e x t doesn’t f i t , u s e t h e s e l e c t t o o l t o

S c o r e l e s s t h a n – 2 0 a n d yo u l o s e .

82

resize it by pulling the corner points in or

out. Wh e n y o u ’v e f i n i s h e d , c l i c k o u t s i d e t h e

Press anyw h e r e o n t h e s t a g e t o s t a r t !

b o x a r o u n d t h e te x t t o s t o p e d i t i n g.

“ S e l e ct ot o” l

G A M E D E S I G N

Game stories

C o m p u t e r g a m e s u s u a l l y h a ve a s t o r y t o e x p l a i n w h y t h e

action in the game is happening. At the moment, Circle

Wars h a s n o s t o r .y Ca n y o u m a k e o n e u p ? I t c o u l d b e a

b a t t l e i n s p a c e , w i t h a b l u e s p a ce s h i p s a v i n g f r i e n d l y

g r e e n s p a c e s h i p s a n d t r y i n g t o a v o i d b e i n g h i t by t h e r e d

e n e m y c r a f t . Le t y o u r i m a gi n a t i o n r u n r i o t ! I n c l u d i n g

some of the story in your instructions will help to make

t h e g a m e m o r e i n t e r e s t i n g a n d e x c i t i n g f o r t h e p l a y e. r
hide

when clicked

uoY a l s o n e e d t o a d d

03

“ a w a i t u n t i l m o u s e d o w ”n

block immediately after

wait until mouse down?

the green flag blocks in the

Player, F r i e n d s , a n d E n e m i e s

s p r i tceosd’ eT. h i s w i l l h o l d

set Score to 0

back all the action until you

reset timer
p r e s s a n y w h e re o n t h e s t a g e .

forever

go to m o u s e -pointer

Run the project and your

13

i n s t r u c t i o n s s h o u l d a p p e ,a r

if Score

filling the screen until you

p r e s s a n y w h e re o n t h e s t a g e .

think Vi c to r y !

P l a y e r s w i l l h a ve p l e n t y o f t i m e

to read and understand the

stop this script

instructions, letting them star t

t h e g a m e w h e n t h e y ’ re ready.

if Score

m’ I r e a d y

think Defeat!

to play!

stop this script

time
set Ti m e to

W hs atth’ e s t o r y ?

D i d y o u t h i n k o f a s t o r y t o e x p l a i n w h sa tg’ o i n g o n i n

Circle Wa r s ? M a y b e si tt ’h e a t t a c k o f t h e d r a g o n s , a n d

t h e p r i n c e s s p l a y e r h a s t o e a t c a k e s t o s u r v ive? Add

some scenery and music to the game to fit with that

story. E x p e r i m e n t w i t h d i f f e r e n t s t o r i e s a n d l o o k s .

T h e ws aover!
r’

A d d a b r o a d c a s t m e s s a g e to

r e v e a l a G a m e O ve r s p r i t e w h e n

t h e p l a y e r w i n s o r l o s e s, l i k e y o u

d i d i n C h e e s e C h a s ueoY. c a n

c h a n g e t h e t e x t o f t h e G a m e O ver

s p r i t e s o t h a t i t r e l ates to your

s t o r y a bout the game.

Slow down, blue!

go to m o u s e -pointer

oT m a k e t h i n g s t r i c k y , c h a n g e t h e

bluescicode
rcle’ so that it no longer

to where
“sitcks” you tell it to go but

Remove the

chases slowly after it. Ifreyou’using

point towards m o u s e -pointer

og“b lto”o c k .

a desktop or laptop computer


, you

could also invent simple keyboard

move 5 steps

controls fo r t h e s p r i t e .

Twea k t h e t i m e r

The number in the timer flickers because it shows lots of

d e c i m a l p l a c e soT. r o u n d t h e v a l u e s o i t s h o w s o n l y w h o l e

s e c o n d s , u s e t h e g rer“eo nu nbdl o” c k n e a r t h e b o t t o m o f

t h e O p e r a t o r s s e c t i o nr T. y a d d i n g“ Bae s t t i mf oe r” w i n n i n g

p l a y e r s , j u s t a s y o u a d d e d“ Hai g h s c o r e” in Cheese Chase.

set Ti m e to round timer


set ghost effect to 50

I n s e r t this instruction immediately

repeat 300

a f “t ew rh e n I s t a r t a s a. c l o n e ”

From gre e n

Operator

Change the size

A d dc t“ h e h a n g e s i z e bb yl o” c k t o

when I start as a clone

the code of both the Fr iends and

Enemies sprites to make each clone

change size by pick random –30

a r a n d o m s i z e . A l te r t h e s c o r i n g s o

t h a t t h e s i z e o f t h e c i r c l e yo u t o u c h

set ghost effect to 50

d e t e r m i n e s h o w m a n y p o i nts you

score.
o u’ Yl l a l s o n e e d to c h a n g e repeat 300

t h e t o t a l s n e e d e d t o w i n o r l o s e Tr. y

m o r e t h a n 2 0 0 0 p o i n t s f o r v i c t o r, y
Change the Fr iends’

s c o r e v a l u e t o t h i s.

a n d l e s s t h a n – 2 0 0 0 f o r d e f e at.

change Score by size

change Score by 0 – size

Use this

scoring for

Enemies.
J u m p y

M o n k e y
P R E S S

M o n k e y s h o w s yo u h o w t o a d d

g r a v i t y t o yo u r g a m e w o r l d s.

A I M O F T H E G A M E

The monkey is on a mission to collect

bananas. Choose which direction he

l e a p s i n a n d h o w f a s t h e g o e suoY. n e e d

t o s e n d h i m o v e r t h e p a l m t re e t o g r a b t h e

b a n a n a s u s i n g t h e f e w e s t p o s s i b l e j u m p s.

Launcher

Point th i s a r r o w i n t h e

direction you want to launch

the monkey by using the

m o u s e o r y o u r f i n g .e r

Monkey

S e l e c t t h e m o n k e ys l ’a u n c h

speed with the on-screen

s l i d ,e tr h e n p r e s s t h e L a u n c h e r

sprite to launch him.

Bananas

If the monkey touches any

of the bananas he will eat

them. Keep going until he

The monkey is launched

eats all the bananas.

from the arrow when

you press on it.


Avoid th e t r e e –

t h e m o n k e y c a n ’t

fly through it.


Type h e r e

to rename

Arrow1

Monkey

the sprite.

x y
Sprite Sprite1 -36 -14

Show S ize 100 Direction 90

Monkey Launcher

Select the Launcher sprite, then add this code to set

up the Launcher and allow the player to control its

when

angle by using the mouse or touching the screen (if

you’re u s i n g a t a b l e t ) T. h e d i r e c t i o n o f t h e a r r ow i s t h e

set LaunchSpeed

direction that the monkey will launch in. Run the code

a n d t r y t u r n i n g t h e a r r o w b y m ov i n g y o u r m o u s e o r

go to x: –200 y: –140

touching differen t p a r ts of the screen.

go to front

This block moves the

arrow to the bottom

forever

left of the stage.

This keeps the arrow

visible, with the

monkey behind it.

This block makes the launcher move

w i t h t h e p l a yse rm’ o u s e - p o i n t e r o r
t h e d r o p - down menu.

hide

LaunchSpeed

11

normal readout

Use the mouse

large readout

or your finger (if

using a tablet) to

slider

adjust the value

of the variable.

change slider range

hide

L I N G O

Events

The key presses and mouse clicks that

a c o m p u t e r d e t e c t s a r e k n o w n a s e v e n t s.

when spa

T h e y e l l o w E ve n t s b l o c k s i n S c r a tc h t r i g g e r

a block of code whenever a particular event

occurs. We’ve s e e n t h e m u s e d w i t h m e s s a g e s

when this s
i n C h e e s e C h a s e , b u t S c r a tc h a l s o l e t s y o u

trigger code blocks using keys, mouse clicks,

s o u n d l e v e l s , a n d e v e n m o v e m e n t d e t e c te d

b y a w e b c a m . D o n’t b e a f r a i d t o e x p e r i m e n t .

when lou

Setting things off

E v e n t s b l o c k s s u c h a s t h e s e a re u s e d t o t r i g g e r

code whenever the event they describe occurs.


oT l a u n c h t h e m o n k e y w h e n t h e

Launcher sprite is pressed, add this

when I receive start launch

n e w c o d e t o t h e M o n k e y s p r i t e.

“ R e p e a t u n ti isl ”a n e w t y p e o f l o o p

go to Launcher

block that keeps repeating the

block inside until the condition

point in direction

becomes true – in this case, the

monkey keeps moving until it

repeat until touching edge

touches the edge of the stage.

move LaunchSpeed

r“Tehpe e a t u n tb il lo”c k

keeps the monkey moving

to the edge of the stage.

go to Launcher

E X P E R T T I P S

“repeat until”

D o y o u w a n t t o k e e p re p e a t i n g a n a c t i o n o n l y u n t i l s o m e t h i n g h a p p e n s

a n d t h e n g e t o n w i t h t h e r e s t o f t h e c o d e ?The
“re p e a t u n t bi ll”o c k c a n

h e l p y o u r c o d e w h “e fon r e v earn“r”edp e aloops


t ” aren’t f l e x i b l e e n o u g h .

M o s t p r o g r a m m i n g l a n g u a g e s u s e s i m i l a r l o o p s, b u t s o m e c a l l t h e m

while

“while”
loops – these continue t h e c o n d i t i o n i s t r u e , r at h e r t h a n

until

looping t h e c o n d i t i o n i s t r u e The
. r e a r e a l w a ys d i f f e r e nt w a y s t o

think about the same problem.


Bananas and trees

The point of this game is for the monkey to collect

b a n a n a s . B y u s i n g c l o n e s , yo u c a n a d d j u s t o n e B a n a n a s

s p r i t e b u t g i v e t h e m o n k e y p l e nt y o f f r u i t t o a i m f o. r

Add the Bananas sprite to the project.

M a k e a v a r i a b l e f o r a l l s p r i te s c a l l e d

“ N u m B a n a n to
a s ”k e e p t r a c k o f t h e

number of bananas on the stage – start

w i t h t h r e e . M a k e s u re t o u n c h e c k i t s t i c k

box. Build the following code to clone

when clicked
t h e b a n a n a s , b u t d o ’nt r u n i t y e t a s y o u

s t i l l n e e d t o t e l l t h e c l o n e s w h a t t o do.

hide

set NumBananas

repeat

create clone of my s e l f
set color effect to pick random –10 to 20

show

wait until touching Monkey ?

change NumBananas by –1

if NumBananas = 0 then

broadcast GameOver

delete this clone

R u n t h e p r o j e cuotY. The game is too easy

1 1 2 1

should be able to get the – we need an obstacle.

monkey to collect all the A d d t hereT e 1 s p r i t e t o

b a n a n a sT. h e r e i s n o c o d e the project. Drag and

r u n b y t“Gh ea m e O v e r ” drop the tree at the

message yet. bottom of the stage.

Yum y u m !

M a k e s u r e y o u r t re e i s s l i

the left of the stage, or

behnidthetreandthegawmtork.
’ewon
or t o u c h i n g erT e 1
touching edge ?
repeat until

LaunchSpeed steps
move

E X P E R T T I P S

R u n t h e p r o j e c t T. h e m o n k e y s h o u l d

, “or , ” “ a n d ” “ n o t ”

41 s t o p f l y i n g w h e n h e h i t s t h e t r e e,

which makes any bananas to the

S o f ,a rm o s t o f t“ihf ethen”
blocks in this book have tested only a

r i g h t o f t h e t r e e i m p o s s i b l e t o re a c h .

s i n g l e c o n d i t i o n , s u c h “i af s t o u c h i n g c ai nt ”t h e S t a r H u n t e r g a m e .

Don’t w o r r, y gr a v i t y w i l l c o m e t o t h e

I n t h i s c h a p t ,e rh o w e v, e ry o u n e e d t o t e s t t wo c o n d i t i o n s a t o n c e :

rescue soon.

“ t o u c h i n g e d g e o r t o u c h .i nCegrToem1 p” l e x s e t s o f c o n d i t i o n s

like these occur a lot in coding, so you need a way to combine them.

I n S c r a t c h , t h e g re e n O p e r a t o r s b l o c k s d o t h e j ouboY.’ l l s e e words

, aa“ n“onnol,di“dktn”e” ra l m” o s t e v e r y p r o g r a m m i n g l a n g u a g e,

or special symbols that do the same job.

I want those bananas!

or

and

not

Logic blocks

L o g i c a l O p e r a to r s b l o c k s s u c h a s t h e s e t h r e e

let you test for complex sets of conditions.


set size to 35 %

set rotation style d o n’t ro t a t e

go to Launcher

Add this block

to “t wh eh e n

set Gravi t y to –0.2

c l i c k ec odd”e .

when I receive start launch

go to Launcher

point in direction direction of Launcher

set Fa l l S p e e d to 0

or t o u c h i n g erT e 1
touching edge ?
repeat until

move LaunchSpeed steps

change y by FallS p e e d

change Fa l l S p e e d by Gravity

go to Launcher

This new block contains the variable

“ G r, a vwi ht yi c h” m a k e s t h e m o n k e y

fall faster each time the loop runs.


m o n k esy m’ o v e m e n t t o s e e m n a t ural,

making the game more engaging.

R u n t h e p r o j e c t a g a i n – y o u c a n n ow d i r e c t t h e m o n k e y o ve r t h e

t r e e t o r e a c h t h e t r i c k y l o w b a n a n a s . B u t h ow e x a c t l y i s t h e S c r a tch

61

gravity wor k i n g ? E v e r y s e c o nd, the monkey falls a little bit faster

t h a n t h e s e c o n d b e f o r e, c r e a t i n g a d ow n w a r d c u r ve.

Fall i n g f a s t e r

T“ahFl el S p e ev da ”r i a b l e m a k e s

the monkey fall further each

t i m e tr“he ep e al ot o” p r u n s .

The monkey moves

sideways by the same

amount each second.

Fal l s t h i s f a r i n t h e

first second.

Fal l s t h i s f a r i n t h e

second second.

Fal l s t h i s f a r i n t h e

third second.

G r a v i t y e f fe c t

W h“aeFl nl S p e ei ds ”c o m b i n e d w i t h

thestraginhiletrofmth,heLaeuncher

m o n k es yp’ a t h c u r v e s b a c k t o w a r d s

t h e g r o u n d i n a r e a l i s t i c m a n n .e r
whe

set

hide

WELLDONE!

hide

uoY used launches

whe

go

Leave a

gap here.

go t

show

Now add a variable for all sprites to count the number

sho
81

o f l a u n c h e s . C a l l t h i s v a r i a b“ Ll ea u, n schhoe ws ” i t o n

t h e s t a g e , a n d r i g h t - c l i c k ( i f y o ure’ u s i n g a m o u s e )

stop

o r l o n g - p r e s s ( i f y o u’re u s i n g a t a b l e t ) o n i t t o c h a n g e

i t “ tl oa r g e r e Ta. d ho ius t ”s h o w s j u s t t h e v a l u e a n d

n o t t h e n a m e o f t h e v a r i a bol eY. u ’ l l re p o s i t i o n t h e

l a u n c h c o u n t e r l a t .e r

R i g h t - c l i c k “ Lo anu n c h e s ”

on the stage. 02

Launches 0

normal readout

whe

large readout

cha

slider

S e l e“ cl at r g e

bro

r e .a d o u t ”

hide

T
SET L AU NCH SPEE DW I T H T H ESLI D E R

P R E S ST H E L AU N C H E R TO F I R E

WELL DONE!

uoY used launches

Make some noise

oT m a k e t h e g a m e m o r e i n t e r e s t i n g , y o u c a n a d d s o m e s o u n d

e f f e c t s . Fol l o w t h e i n s t r u c t i o n s b e l o w t o p l ay d i f f e r e nt s o u n d s

when the monkey is launched and when he eats the bananas.

S e l e c t t h e M o n k e y s prite, go to the

32
when I receive start launch

S o u n d s t a b , a n d l o“aBdoing”
from

t h e l i b r a rTh
. y e n a d sd“ taa r t s o u n d ”

block to the existing monkey code start sound B oing

i n t h e p o s i t i o n s h o w n h e r [Link] i s w i l l

m a k e t“hbeo i ns og ”u n d p l a y e v e r y
go to Launcher

time the monkey jumps.

Choose the Bananas sprite and load show

24

“Chomp”
f r o m t h e s o u n d l i b r a r. y

T h e n a d sd“ taa r t s o u nbdl o” c k t o wait until touching Monkey

the existing banana code in the

position shown here. Now the

start sound Chomp

hc“ o m p i ns go ”u n d w i l l p l a y e a c h

time the monkey gets a banana.

change NumBananas
s t a g e a n d s e l se“ clT.t i dh e r s”l i d e r l e t s y o u c h a n g e

the value of a variable on the stage.

Gravity
-0.2
Gravi

normal readout

large readout

slider

Select the

s “l i d e or p ”t i o n .

hide

E X P E R T T I P S

Displaying variables

uoY c a n c h a n g e h o w a v a r i a b l e i s

Shows

s h o w n o n t h e s t a g e The
. re are thre e

the name.

different options: normal readout,

l a r g e r e a d o u t , a n d s l iodYe. r u c a n

also hide the variable using this

menu. Choose the look that works

b e s t f o r y o u r g a m e.

normal readout

large readout

slider

Lets you change

the value.

Shows just

the value.
A negative gravity value makes

t h e m o n k e y f a l l d o w n w a rd s , s o

i s c l o s e s t t o r e a l l i fe.

G A M E D E S I G N

Game physics

P h y s i c s i s t h e s c i e n ce o f f o r c e s a n d m o v e m e n t i n t h e

real world. G a m e p h y s i c s i s a l l a b o u t g e t t i n g t h a t

s c i e n c e i n t o g a m e s , s o t h a t t h i n g s r e a c t a n d m o ve

a r o u n d i n r e a l i s t i c w ay s – b e i n g p u l l e d d o w n b y

gravity, f o r i n s t a n c e , o r b o u n c i n g . P ro g r a m m e r s h a ve

t o s o l v e a l l s o r ts of physics problems to make games

m o r e r e a l i s t i c o r f u n .W h e n o b j e c t s c o l l i d e , s h o u l d t h e y

b o u n c e o r c r u n c h ? H o w s h o u l d o b j e c t s m o ve w h e n

they go underwater or into space?

G a m e p h y s i c s d o e s ’nt h a v e t o b e l i k e re a l - w o r l d

physics – yo u can create wo r l d s w i t h g r a v i t y

that makes things fall upwards or even sideway

Gravity can be much stronger or weaker than

in real life – perhaps balls fly higher with eac

b o u n c e , u n t i l t h e y s h o o t o f f i nto space.
Try a d d i n g m o r e b a n a n a s , A d d m o r e f r u i t w i t h a d i f fe r e n t s c o re f o r e a c h

m a k i n g t h e m b i g g e r o r s m a l l ,e r t y op eY. u ’ l l n e e d to m a k e“ Score”
avariable

a n d p u t t i n g t h e m i n d i f f e r e nt and add extra sprites – there are oranges and

places on the screen. w a t e r m e l o n s i n t h e S c r a tc h s p r i t e l i b r a r. y

Beat the clock

u o Y can add a timer to make the player complete the game in

a set time. Create a new variable called


“ TimeLeft”
and add the

code below to the Mon key sprite


T . hen create a new sprite, click

on the Costumes tab, and make a .sign that“ ssays


Up”Time’

Fin,aladd
ly the two cod e b l o c k s o n the right to this sprite.

when

This sets the

hide

when clicked

timer to 20.

Make sure this

set Ti m e L e f t to 20

variable is visible

on the stage.

repeat 20 w h e n I r e c e i v e sTime’
Up

wait 1 seconds go to x: 0 y

change Ti m e L e f t by –1 go to front

show

b r o a d c a s t sTimU ep’ stop all


This will start the launch if you make a

l o u d n o i s e . R e m e m b, e Sr c r a t c h i s o n l y

l i s t e n i n g f o r n o i s e s, i t i s ’ nt re c o r d i n g yo u .

Danger! Snake!

Add another challenge by

creating an obstacle that gets

i n t h e m o n k es yw’ a y o r m a y b e

ends the game – perhaps a giant

monkey-eating snake or spider?


Bug or bonus?

u o Y might have discovered that you can adjust the

m o n k es ys ’p e e d i n f l i g h t w i t h t h e L a u n c h S p e e d

s ol i dY.e r u c a n f i x t h i s b y a d d i n g a n e w v a r i a b l e ,

“ M o n k e y S, paenedd c” o p y i n g t h e v a l u e o f

“ L a u n c h S p e ei nd t” o i t a t l a u n c hT. h e n u s e

M o n k e y S p e e d , n o t L a u n c h S p e e d , i n t h e m o ve

b l o c k f o r t h e m o n k e. y O, r if you enjoy being able to

Launch speed s

c h a n g e t h e m o n k es ys ’p e e d , l e a v e t h e g a m e a s i t i s .

uoY’ v e a l re a d y t r i e d a d d i n g a s l i d e r t o

c o n t r o l g r a v i t . yoY u c o u l d a l s o a d d a

slider to adjust launch speed.

Gravity

LaunchSpeed
D o o m o n

t h e B r o o m
with animation.

A I M O F T H E G A M E

The witch is out riding her broomstick in

t h e w o o d s w h e n c r e a t u re s o f t h e n i g h t

b e g i n t o a d v a n c e o n h e r f ro m a l l s i d e s .

She must cast her fireball spell to dispose

of the bats, ghosts, griffins, and dragons

t h a t h a v e t a k e n a f a n c y t o h e r f o r d i n n e. r

◁ Witch

T h e w i t c h s i t s i n t h e c e n t re o f t h e

screen. Spin her broomstick with

y o u r c o m p u t e r m o u s e o r y o ur

f i n g e r ( i f y o ure’ u s i n g a t a b l e t ) a n d

cast fireballs with the Spell button.

◁ Enemies

E v e r y e n e m y h i t b y a f i re b a l l i s

destroyed and a point is scored.

As you win points, the game

speeds up.

◁ Lives

The witch loses a life if she is

EXTRA
touched by any of her enemies.

LIFE

But if a flying hippo touches

S u p e r fast griffins have

her, s h e w i n s a n e x t r a l i f e. a speedier attack.


The witch stays in the

c e n t r e o f t h e s t a g e.
The costume will appear as a sprite in the

sprites list.

L o a d t h e s o u“Cave”
nf rdo m t h e s o u n d

G o t o t“Ch he o o s e a B a c k d r o ”p symbol

2 3

l i b r a r y a n d a d d t h i s c o d e t o t h e s t sa g e’

a n d a d d t h e b a c k d r“o. ThpWiosods”
will lend

code area. Run the project and admire

an eerie setting to the game, which fits with

t h e s p o o k y a t m o s p h e r e y o u’ve created.

the theme.

when c l i c ke d

forever

play sound C ave

Forextra creepiness, add this code to

the stage to make it slowly but continually

change colour while the game is playing.

This block changes all the

colours in the backdrop

by a small amount each

when c l i c ke d

t i m e si t r u’ n .

forever

change color effect by 1


c o s t u m e s T. h e s eco s t u m e s
bat-a

159 x 120

can be used to make the

b a t f l a p i t s w i nog sY. u only

need two costumes


“ bat-a”–

a“nbat-b”
d– for this game.

Delete the rest.

bat-b

101 x 105

G A M E D E S I G N

Animation

ouY c a n m a k e p i c t u r e s a p p e a r t o m o ve b y a l l c a r t o o n s w o r k . S c r at c h l e t s y o u a n i m a te a

showing slightly different versions of the s p r i t e b y r a p i d l y c h a n g i n g co s t u m e s t h a t s h o w

s a m e p i c t u r e o n e a f t e r a n o t h [Link] i s f o o l s t h e i t i n d i f f e r e n t poses. Wh e n t h e s e c o s t u m e s a p p e a r

b r a i n i n t o t h i n k i n g t h a t i t i s a s i n g l e m ov i n g o n e a f t e r t h e o t h e, r y o u c a n s e e f l a p p i n g b a t s ,

i m a g e .T h i s i s c a l l e d a n i m a t i o n , a n d i t i s h o w w a l k i n g c a t s , a n d j u m p i n g f ro g s .
game and the

things up and to control her using the

W i t c h s p r i t e.

mouse or when the player touches

the screen. Read the code carefully

and test it to see if it works.

This control loop

continually checks on

Controlling the pace

t h e m o u s e - pointer

T h e v a r i a b“ lGea m e S p e e d ”

that spins the witch.

c o n t r o l s t h e o ve r a l l p a c e o f

t h e g a m e . oF r n o w f i x i t at 1.

Later
, you’l find out how to

increase it as t h e s c o r e rises,

speeding up the game.

Casting fireballs

The witch’
s o n l y d e f e n c e a g a i n s t t h e r a m p a ging

s p o o k s w i l l b e h e r f i r e b a l l s p e l l The
. next bit of code

w i l l m a k e a f i r e b a l l s h o o t f r o m h e r b ro o m s t i c k w h e n

the player touches the spell button.

Rename the

Add the Ball sprite

9 sprite here.

f r o m t h e l i b r a r y and

r e n a m e“Fii tr. e b a l l ”

Sprite iFr e b a l l

I s t c’ u r r e n t l y t o o b i g,

but you’ l l s h r i n k i t

Show

down in a moment.

Select this icon to open

t h e s p r i t e s l i b r a r. y

Choose a Sprite
Witch
move 10 steps

when clicked

set size to 10 %

delete this clone

hide

This block hides the

original sprite so that

you only see the clones.

Next, add a button that will summon the magic

1 1

f i r e b a l l s p e l l W. h e n t h e b u t t o n i s p r e s s e d i t w i l l

b r o a d c a s t a m e s s a g e n a ms“e tda r t .s pG eo l tl o” t h e

Lives

s p r i t e s l i b r a r y and add the Button2 sprite, rename it

Score

“, S ap ne dl l p” l a c e i t o n t h e b o t t o m r i g h t o f t h e s t a g e.

T h e n a d d t h e f o l l o w i n g c o d e t o t h e S p e l l s p r i t e.

when this sprite clicked

broadcast start spell

O p e n t h e d r o p - d own

menu and create a new

m e s s a g e c a ls “ltea dr t. s p e l l ”

Now add this code to the witch to create a clone of

2 1

the Fi r e b a l l s p r i t e w h e n t h e S p e l l s p r i t e i s p r e s s e d .

w h e n I r e c e i ve start spell

E v e r y t i m e t h e b u t t o n i s p r e s s e d a m a g i c s t re a m o f

f i r e b a l l s w i l l s h o o t o u t o f t h e w is t c ’h b r o o mT. h e r e w i l l

repeat 50

b e 5 0 f i r e b a l l s s h o t o u t o v e r 5 s e c o n d rsT. y t h e c o de

a n d c h e c k i f y o u c a n s p i n t h e w i t c h a n d s h o o t f i r e balls.

create clone of Fi r e b a l l

Once the fireball spell wears off press the button

again to restart the spell.

wait 0.10 seconds

This block creates a

clone and triggers

the code above.


forever

These blocks

create bats eve r y

wait pick random 5 to 10


5–10 seconds.

create clone of my s e l f

when I start as a clone

go to x: 0 y: 0

point in direction pick random –180 to 180

move 300 s te p s

show

p o i n t t o w a r d s Wit c h

touching Wit c h ?
repeat until

move GameSpeed steps

touching Fireball ?
if then

play sound Po p until done

change Score by 1

L o a d t h e s o u“ noPp”d

f r o m t h e s o u n d l i b r a r. y

delete this clone

broadcast L o s e a l i fe

G o t o t h e d r o p - down menu,

s e l e“ Nc te w m, e as snadg e ”

delete this clone

n a m e t h e m e s s a“ gLoes. e a l i fe”
R u n t h e p r o j e c t t o s e e i f i t wo r k s . A b a t s h o u l d
I s t a’ g o o d i d e a t o r e m o ve a l l t h e b a t s w h e n e v e r

41 5 1

appear after a few seconds and will move


t h e w i t c h l o s e s a l i f [Link] i s g i v e s h e r a c h a n c e

t o r e c o v e r b e f o r e t h e n e x t w a v e o f a t t a c k e r s. t o w a r d s t h e w i t c h . S o o n m o r e w i l l a p p e .a r

T h e w i t c h s h o u l d b e a b l e t o u s e h e r f i re b a l l s
A d d t h i s c o d e t o t h e b a t t o d o t h e j o b . Whe n

to destroy them. All the bats will disappear


t h e m e s s a“gL eo s e a l i f e” i s r e c e i v e d, e v e r y

c l o n e r u n s t h e c o d e a n d a l l t h e b a t s d i s a p p e .a r when one finally reaches the witch.

w h e n I r e c e i ve L o s e a l ife

delete this clone

uoY m i g h t n o t i c e t h a t t h e b a t s a r e n’t f l a p p i n g

61

a n y m o r eoT. f i x t h i s , a d j u s t t h e c o d e b e l o w

s o t h a t i t r u n s f o r e a c h c l o n e r at h e r t h a n j u s t

the original sprite.

when I start as a clone


when

forever

Add this block to

t h e s t a r t of the code.
A d d t h i s c o d e t o t h e w i tc h t o m a k e

7 1

h e r r e a c t t o l o s i n g a l i fe . I f s h e s t i l l

w h e n I r e c e i ve L o s e a l ife

has lives left, she will disappear for

two seconds before returning to

hide

b a t t l e . I f s h e’ o u t o f l i v e s , t h e n si t ’

g a m e o v.e rA d d a n e w m e s s a g e ,

start sound S cream1

“ G a m e O, vweh ri c h” y o u ’ l l n e e d l a t e r

i n t h e p r o j e c t . N o w t r y t h e g a me change Lives

again. Th e w i t c h s h o u l d l o s e l i v e s

and stop completely when the

Lives > 0

if

“ L i vve as ”r i a b l e h a s a v a l u e o f 0 .

wait 2 seconds

show

This makes the witch

else

reappear after a pause

if she has any lives l e f t .

broadcast GameOver

wait 1 seconds

T“ hG ea m e O ve r ” message

stop all

will trigger a sign that

you’ll c r e a t e l a t. e r

oT c r e a t e f i r e wo r k s y o u n e e d a n e w s p r i te. Load

81

a n o t h e r B a l l s p r i t e f r o m t h e s p r i t e s l i b r a r y rather

than copying the Fireball sprite. Rename this new

s p r “i tE ex p l o s i oa n ”d t h e n c l i c k o n t h e C o s t u m e s

tab. Sel e c t t h e s e c o n d c o s t u m e s o t h a t t h e b a l l

turns blue.
show
set size to 5 %

repeat 72
repeat until

turn 5 degrees

move 10 steps

create clone of my s e l f

hide

This makes each clone point

i n a d i f f e r e nt d i r e c t i o n .

When the Explosion sprite

02

r e c e i v e s t h e m e s s a“gL eo s, e a l i f e”

all the blue ball clones appear

a t t h e w i tsc hl ’o c a t i o n a n d
Score 0

explode out to the edge of the

s t a g e b e f o r e h i d i n g o n ce a g a i n .

Run the game and let a bat reach

the witch to check how it works.

When a bat touches the

witch, she explodes into a

circle of flying blue balls.


2 32
1
C o s t u m e s t a b – y o u’l l c o s t u m“eGs r, i f f i n - a ” a nd

see the copied black “ G .r i f f i n - ”b T h e ys how

b as tt ’w o c o s t u m oe Ts . a griffin with wings in

bat-a

143 x 91

make Fa s t g r i f f i n l o o k t w o d i f f e re n t p o s i t i o n s .

d i f f e r e n t f ro m t h e b l a c k Remember to delete the

bat, you need to load u n n e c e s s a r y black bat

some new costumes. costumes in this sprite.

Select the symbol oT d o t h i s , s e l e c t t h e

bat-b

101 x 105
at the bottom left of costume you want to

the Scratch window to delete and then click

choose a new costume the small trash icon

f r o m t h e l i b r a r. y in the top right.

Click here to add

new costumes.

oT s p e e d u p t h e f a s t g r i f f i n ,

24
GameSpeed
move

c h a n g e m“i tbove”
sl o c k t o m a k e

the griffin move twice as fast

as the black bat.

touching Wit c h ?
repeat until

move GameSpeed steps

touching Fireball ?
if then

play sound Po p until done

change Score by 1

delete this clone


answers appear in a speech bubble.

wait 20 seconds

forever

7 + 2

7 – 2

wait pick random 15 to 20

9 5

create clone of my s e l f

7 2
7 / 2
*

14 3.5

C h e c k y o u h a v e f o u r c o d e b l o c k s i n a Fs t
Code Costumes

griffin’
s c o d e a r e a , j u s t l i k e i n B a t. Run the

62
Motion

Motion

g a m e . A f t e r a f e w b l a c k b a t s h a ve a t t a c k e d ,

move 10 steps

a f a s t ,e rm u c h m o r e d a n g e r o u s g r i f f i n w i l l Looks

turn 15 degrees

a p p e ,a rf l a p p i n g a w a. y

turn 15 degrees

Sound

Events

go to random position

go to x: 0 y: 0

Control

glide 1 secs to random position

Sensing

glide 1 secs to x: 0 y: 0

Operators

point in direction 90

Vari a b l e s

point towards m o u s e -pointer

My Blocks
c o s t u m“ De sr a g o n 1 - a ” and

“ D r a g, otnh1e- nb ” d e l e t e

Dragon

the two bat costumes.

when I start as a clone

forever

Type t h e

n e w s p r si t e ’

switch costume to Dragon1-a

name here.
x
Sprite Dragon 20

wait 2 seconds

Show S ize 100

switch costume to Dragon1-b

wait 0.5 seconds

Dragon

N e x t , m o d i f y t h e d r a g so ’n

92 repeat until
touching Wit c h

movement to make it fly in

a spiral path by moving the

p o i n t t o w a r d s Wit c h

“ p o i n t t owards Witch”
block

i n t o tr“eh pe e a t u n t i l ”

turn 80 degrees

l o o p a n d a d d i n g“ t au r n

r i g h t 8 0 d e g r e e s” block.

move GameSpeed

touching Fireball
if

play sound Po p until done

change Score by 1

delete this clone


G A M E D E S I G N

Working with themes

In Doom on the Broom, spooky scenery and the elements of a game can make it feel polished

supernatural characters work together to give the and professionalWo. r k ing with themes is also great

game a theme. A strong theme that ties together fun as you can let your imagination run wild.

Story

Music and sound effects

A background story or quest helps give a game a

[Link] the player is trying to escape a haunted Sounds in a game have a big influence on how the

house, searchof r underwater treasure,or explore an player feels. Spooky music makes the playe r n e r v ous,

alien planet. Instead of inventing a story


, you can use b u t j o l l y m u s i c m a k e s a g a m e f e e l c h e e r ful, even if the

a well-known one,but give it a twist, such as putting pictures are spooky


. Choose sound effects carefully so

Goldilocks and the three bears in space. they match the sprite or situation that triggers them.

△ △

Scenery Sprites

I f y o u c h o o s e t h e r i g h t b a c k d r o p , s p r i te s i n t h e g a m e The player is usually the hero in a game, so choose

w i l l l o o k l i k e t h e y a r e r e a l l y t h e re r a t h e r t h a n s t u c k o n a l i k a b l e s p r i t e T. h e e n e m i e s d o n ’t h a v e t o l o o k

top.
uoY c a n c r e a t e y o u r o w n b a c k d r o p s i n S c r as tch’ scary – even cute sprites can seem scary when they

p a i n t e d i t ,o rb u t y o u c a n a l s o u p l o a d i m a g e s y o u’ve a t t a c k . I f p l ayers have t o c o l l e c t o b j e c t s , m a k e t h e m

f o u n d o r c r e a te d e l s e w h e r e . l o o k v a l u a b l e , s u c h a s c o i n s o r g e m s.
a“ nG. dh o s t - ”b

Ghost2-a

143 x 142

C h a n g e t h e g h o ss tc’o d e s o t h a t i t m o v e s s l o w l y a n d f a d e s o u t

33

when hit by a fireball. Go to the Sounds tab above the blocks

p a l e t t e a n d l o a d t“hS ecreech”
s o u n d f r o m t h e s o u n d l i b r a r. y

T h e n c h a n g e t h e s e l e c t i o n i n st“h tea r t s o u nbdl o” c k “ tScreech”


o

t o m a k e t h e g h o s t s c r e a m w h e n i t v a n i s h e s.

touching Wit c h ?
repeat until

Change the block

move 1 steps

m“ toov e . 1 s t e p s ”

touching Fireball ?
if then

start sound S creech

repeat 100

change ghost effect by 1

This makes

the ghost fade.

change Score by 1

delete this clone


Once all of your

53

changes are complete,

t e s t t h e g a m reT. y

fireballing each

Score 30

enemy to make sure

the code works.

The ghost

should slowly

fade when hit

with a fireball.

uoY can go to the Scratch librar y a n d a dd more

63

monsters to your game. Remember to copy the

Bat sprite and replace its costumes with new

ones to avoid having to rebuild the code from

the beginning. Update t h e n e w m o n s st ecode


r’

to use the new costumes and adjust the timings.


Select the paintbrush symbol

Costume
costume1

73

in the sprites list to create a new

s p r i t e i n t h e p a i n t e d i t .o rU s i n g

Fill Outline

“Conver t t o ,B di tr map”
aw a

rectangle and fill it with a dark

c o l o .u rN o w s w i t c h “Cot on v e r t

toeV .c Gtoo r t o” t h e t e x t t o ol,

choose a font you like, and select

r e d f o r t h e te x t c o l o .u rC l i c k i n

t h e r e c t a n g l e a n d t y“Gp AME
e

O V E aR n! ”d u s e t h e s e l e c t i o n

t o o l t o m a k e t h e t e x t l a rge.

Type “GAME

O V EhRere.
!”

Convert to Bitmap

N o w a d d t h e s e c o d e b l o c k s t o t h e n e w s p r i t e to

83

hide it at the start and show it only at the end

when

when the witch loses all her lives. Run the game.

O n c e t h e w i t c h l o s e s a l l h e r l i v e s, t h e m e s s a g e

hide

w i l l b e d i s p l a y e d o n t h e s t a g e.

go to x:

Rename

when I receive GameOver

GAME

the sprite

OVER!

“ G a m e .O v e r ”

wait 1 seconds

Game Over

show
Challenger mode

As players become more skilled and score


oT m a k e t h e g a m

40

scores points, a

m o r e p o i n t s , t h e y m ay s t a r t t o g e t b o r e d

movement loop

w i t h t h e g a m euoY. c a n p r e v e n t t h i s by

variable using

m a k i n g t h e g a m e f a s t e r a s i t p r o g re s s e s .

when c l i c ke d

set GameSpeed to 1

set Score to 0

set Lives to 3

set size to 35 %

go to x: 0 y: 0

How does it work?

point in direction 90

T h e G a m e S p e e d s e t t i n g i n c r e a s e s w ith the score.

Forevery 100 points, t h e s p e e d i n c r e a s e s b y 1 .

show

W h e n t h e s c o r e i s 0 , G a m e S p e e d i s 1 W. h e n t h e

score is 50, GameSpeed is 1.5, and after 100 points

forever

the game runs at double speed.

point towards m o u s e -pointer

Lower this value to

make the game

s p e e d u p s o o n. e r

set GameSpeed to Score / 100 + 1


snit’ an enemy
. Rename. the sprite
“H pi po”

Amend the code blocks so that instead of gaining a point

42

w h e n y o u f i r e b a l l t h e h i p p o, y o u e a r n a n e x t r a l i f e w h e n

i t t o u c h e s y o u . C h a n g e t h e v a l u e i n tp“hoei n t i n d i r e c t i o ”n

b l o c k s o t h e t e x t o n t h e h i p p o d o e s ’nt g e t r e v e r s e d .

Change this

v. a l u e“ 0to”

point in direction pick random –180 to 0

move 300 s te p s

show

p o i n t t o w a r d s Wit c h

touching Wit c h ?
repeat until

move GameSpeed steps

touching Fireball ?

if then

play sound Po p until done

delete this clone

change Lives by 1

delete this clone

This block adds an extra

l i f e t o t h eWitc h s p rsi t e ’

l i v e s c o u n t. e r
skcaH t kdna ae w s

N o w t h a t y o u’ve go t y o u r g a m e

to work, yo u can experiment and

m a k e i t y o u r o w n by c h a n g i n g

a n d a d d i n g e l e m e n t sr T. y t h e s e

s u g g e s t i o n s t o g e t s t a r t e d.

FlyingWi t c h

uoY c a n m a k e t h e w i t c h f l y

when clicked

instead of rotating on the

forever
spot by adding the code

s h o w n h e r eoT. m a k e h e r

move 1 steps

turn faster while flying,

increase the numbers in

“hteurr n ” blocks.

This block will keep

the witch flying.


D i n n e r
key to success is timing your jumps

p e r f ectly so you stay in the game.

A I M O F T H E G A M E

T h e d o g l i k e s b o n e s b u t h a t e s j u n k f o od.

Steer him through three levels, jumping

f r o m p l a t f o r m t o p l a t f o r m . Co l l e c t a l l

the tasty bones on the stage and then

g o t h r o u g h t h e p o r t a l t o t h e n e x t l e v e l.

But make sure he avoids the unhealthy

c a k e s , c h e e s y p u f f s, a n d d o n u t s !

Dog

U s e t h e l e f t a n d r i g h t a r r ow k e y s o r

the gamepad to make the dog run.

When he needs to jump, press the

space key or touch the gamepad

near the top.

Bones

uoY n e e d t o c o l l e c t a l l t h e

b o n e s t o o p e n t h e p o r t al to

the next level. It will remain

s h u t u n t i l y o u ’v e g o t t h e m a l l .

Junk food

I f t h e d o g t o u c h e s a n y j u n k food,

is t g’ a m e o v e r a n d y o u h a v e t o

s t a r t a g a i n on Level 1 – no matter

which level you were on!


The dog must

jump over the gaps.


C r e a t e a n e w p r o j e c t a n d n a m e “ Di st og’oD Ti . n n emr a” k e

y o u r s i m p l e p l a y ,e r go to the paintbrush symbol in the

s p r i t e s m e n u . M a k e s u r e y o u s e l e“Coc tn v e r t t o B. i t m a p ”

C h o o s e r e d f r o m t h e c o l o u r p a l e t t e i n t h e p a i n t e d i t ,o rs e l e c t

the rectangle tool, and click on the filled square option.

Select the

paintbrush Choose red from

Paint

symbol. the palette.

Click with the mouse, or your finger (if

Code

you’re u s i n g a t a b l e t ) , a n d d r a g o ve r

t h e p a i n t i n g a r e a t o d r aw a s m a l l r e d

s q u a r e . O n a c o m p u ter, h o l d i n g d o w n

the shift key will give you a square

r a t h e r t h a n a r e c t a n g l e. I f y o u c l i c k

costume1

outside your block and look at the list

35 x 35

of costumes, you’ll see the size of the

square; aim for 35 x 35.

The block should

be smaller than

t h e c sa tf a’ c e o n

the stage.
to resize the block.

Now add a simple platform. Select the

paintbrush symbol in the sprites menu again

t o c r e a t e a n e w s p r i t e . U s e t h e re c t a n g l e t o o l

t o d r a w a f l o o r w i t h t wo o b s t a c l e b l o c k s o n

top. Cal l t h i s s p r “i tPel a.t fOo rnmtsh” e s t a g e ,

drag your Playe rBlock and place it between

t h e o b s t a c l e s , b u t m a k e s u r e s i tn’ o t t o u c h i n g

the platform.

T“ hPle a y e r B l o cs kp ”r i t e c a n b e m o v e d u s i n g

6
t h e k e y b o a r d a r r o ws , o r ( i f y o u’re p l a y i n g o n

when clicked

a tablet) by touching a gamepad on the

s c r e e n . A d d t h e B u t to n 1 s p r i t e f r o m t h e

go to x: –200 y: –145

l i b r aor yT . make it look more like a gamepad

set ghost

f o l l o w t h e i n s t r u c t i o n s gi v e n i n s t e p 4 a n d

5 o f C h e e s e C h a s e ( s e e p p . 52–53). Th e n

forever

add this code to the Gamepad sprite to

m a k e t h e b u t t o n a l w a y s p o i n t towards the

hide

d i r e c t i o n o f y o u r f i n g .e r

point in direction 1

When the player touc hes

if

the screen, the gamepad

points in that direction.

show

point towards m o u s e -pointer

Rename the sprite

“ G a .m e p a d ”

Gamepad
Code tab and choose My Blocks.

of your new

block here.

Code
Sounds

Costumes

My Blocks

Motion

Make a Block

Looks

Sound

Events

Control

Sensing

Operators

Vari a b l e s

Make a Block
My Blocks

Run controls

L I N G O

Subprograms

S c r a t c h l e t s y o u gr o u p t o g e t h e r b l o c k s u n d de r“ a efine”
header

b l o c k a n d r u n t h e m b y u s i n g a n e w b l o c k t h a t y o u n a m [Link]

saves you buil ding the same group of blocks again if yo u want to

u s e i t i n m o r e t h a n o n e p l a c e . (However
, the new block will only

w o r k w i t h t h e s p r i t e t h a t yo u c r e a t e d i t for. ) G i v i n g y o u r n e w b l o c k

a m e a n i n g f u l n a m e w i l l m a k e y o u r c o d e e a s y t o u n d e r s t a n d. M o s t

p r o g r a m m i n g l a n g u a g e s l e t yo u t a k e s o m e u s e f u l c o d e , g i v e i t a

n a m e , a n d w r a p i t u p a s a u n i t . D i f fe r e n t l a n g u a g e s c a l l t h e s e u n i t s

d i f f e r e n t t h i n g s : s u b p r o g r a m s , s u b r o u t i n e s , p ro c e d u r e s , and

functions are some common names.


change x by
0 –

I n t h e aV r i a b l e s s e c t i o n ,

01

create a variable for all

s p r i t e s c a l l“eRdu n S p e e d ”

to control how fast the

player moves l e f t a n d

right. Uncheck the tick box

if

s o i t d o e s n ’t a p p e a r o n t h e

s t a g eT. h e n b u i l d t h e c o d e

change x by 0 –

shown here under the

ed“ fine”
h e a d .e rA n y w h e r e

touching Platforms
w e u s e t“hReu n c o n t r o l s ” if

block, Scratch will now

run this code.

change x by RunSpeed

The left control works

in a similar way to

t h e r i g h t c o n t r o l.

key l e f t a r row pressed? or direction of Gamepad < -35

N o w r u n t h e p r o j e cuotY. s h o u l d b e a b l e t o
Next, add the code below

2 1
1 1
move the red block left and right with the
to use your new custom

a r r o w k e y s o r t h e g a m e p a d, b u t n o t b e a b l e
b l o c k i n“ f ao r e v loop.
er”

to move throug h the obstacles.

Type “5” h ere.

when clicked

set RunSpeed to 5

forever

Run controls
define S i m u l a t e g r av i t y

change y by FallS p e e d

if touching Platforms ? then

change y by FallS p e e d
0 –

This block makes the PlayerBlock stop

set Fa l l S p e e d to 0

falling when it lands on a platform.

else

change Fa l l S p e e d by
Gravity

uoY n e e d t o

set the value

of gravity!

I n s e r t the blocks

41

shown here into the

P l a y e r B l o sc km’ a i n

code. Make sure

you set the value of

“ G r a v i t“ y–tao1n ”d

s e t a Fl l S p .e e d “ 0to”

I n s se“ r ett G r a v i t y t ”o and

“set Fa l l s p e e d hteor ”e .

“PSui tm u l a t e gr a v i t y ”

i n t o “t fh oe r e vloop.
er”
Nerounwsiocetgryuaohetjm
u’fIp.

61

acompuetarndkeyboujas,add
drt

define Jump control

somenewcodeotgviethePalyeBrolck

anupwardkcikwhenoyupresthe

tsrmake
i.F, spanew
cebarvaraible

key space
if

T . his akeof“fSpeed”Tsofpaltericseald

supwsiathdrspepleeadyeronuaj’m
.p

set Fa l l S p e e d

J Th“enceraetnewbolckcaeldump

[Link]”tl

o T maketheujmpworkonatblet

a lwldde’somecodenithenextsection

s(tep21and22).

I n s se“ar etktTe o f f S p e e d t o “ h e r e .

when c l i c ke d

A d d st“ haetekTe o f f S p e e d t o ”

7 1

b l o c k i n t o t h e P l a ye r B l o cs k ’

set a keT o f f S p e e d to 12

m a i n c o d e a n d s e t . i t “ t1o2 ”

I n s e r Jt t“h e u m p c o n t r o l ”

set RunSpeed to 5

b l o c k i n t o t“hf eo r e v loop.
er”

set Gravit y to –1

set Fa l l S p e e d to 0

What happened

there?

forever

Run controls

Jump control

J u m“ pP u t

c o n t ri on lt ”o t h e

Simulate grav i t y

“ f o r e vloop.
er”
T h e r e a r e t wo b u g s t h a t s p o i l o u r j u m p s : o n e

c a u s e s t h e P l a y e r B l o c k to j u m p i n f i n i t e l y h i g h ;

t h e o t h e r s t o p s i t f a l l i n g s m o o t oh lY.y u c a n f i x

t h e m b y t w e a k i n g t h e j u m p a n d g r a v i t y c o ntrols.

This block moves the

P l a y e r B l o c k d o w n o ne step.

define jump control

key space pressed?


if then

change y by –1

touching Platforms ?
if
then

set Fa l l S p e e d to
kaTe o f f S p e e d

change y by 1

This block cancels out the

s m a l l d o w n w a r d step.

Try t h e c o d e a b o v e a n d yo u ’ l l f i n d y o u

20

can only make single jumps from the

p l a t f o r m a n d c a ’nt l e a p h i g h e r b y t a p p i n g

the space key lots of times.


if mouse down? then

show

point towards m o u s e -pointer

if abs of direction < 50

broadcast jump and wait

Next, add this code to the

P l a y e r B l o c k s p r i t eT. h i s

when I receive jump

behaves the same way as

the code blocks in the Jump

change y by –1

controls subroutine you made

e a r l i .e rN o w w h e n y o u p r e ss

if touching Platforms

near the top of the gamepad

i t w i l l m a k e t h e P l a y e r B l o ck

set Fa l l S p e e d to

jump up.

The PlayerBloc k will

change y by 1
jump only when it

touches a platform.
if touching Platforms
n e g a t i v“ eR )e, v e r s e S tep”

is set to +1 (up).

if FallS p e e d

If the PlayerBlock is

set R e v e r s e S te p to 1

r i s i n g o r s t a t i o n a r, y

“ R e v e r s e S t e ”p is set

else

to –1 (down).

set R e v e r s e S te p to –1

The red square

repeat until not touching Platforms

r e v e r s e s b y 1 step.

change y by ReverseStep

set Fa l l S p e e d to 0

How it works

else

When the PlayerBlock hits the

p l a t f o r m , tr“eh pe e a t u n t i l ”
change Fa l l S p e e d by

loop reverses the Pl ayerBlock

u n t i l i t s i t s j u s t o n e s t e p a b o ve

the platform.

The PlayerBlock lands

inside the platform.


that appears.

T“ hMe a k e a B l o cbox
k”

52

a p p e a r s a g a i Tin“ cR. ku n

w i t h o u t s c r e e n . r e f resh” Th i s

w i l l m a k e t h e g r a v i t y c o de

run all in one go (without

showing each reverse step),

which will get rid of the

s l o w - m o t i o n e f f e c t.

Add an input Ad d a n i n p u t

T i c k t h i s b o x to

number or text

make the code

r u n m u c h f a s t. e r

R u n w i t h o u t s c r e e n r e f re s h

N o w t r y j u m p i n g a g a i n . Th e t w e a k s

62

you’ve ma d e s h o u l d h e l p t h e P l a y e r B l o c k

t o j u m p a n d l a n d v e r y smoothly.
stage. Add it to the

down, but in some games you can


“forever” l o [Link] n

s t e e r l e f t a n d r i g h t d u r i n g t h e j u m p.
b u i l d t h e s h o r t bit of

code at the bottom

of the page to stop

the sprite when it

g e t s t“hGea m e O v e r ”

m e s s a eg seTt. t he

new code: the

Double jump

controls should

T h i s i s t h e j u m p y o u h a d b e f o re you

stop working when

f i x e d t h e i n f i n i t e j u m p i n g b u g – you

you hit the deck.

c a n j u m p a g a i n i n t h e a i r t o g o h i g h .e r

In some games there are limits on

d o u b l e j u m p i n g – f o r e x a m p l e , you

Drop this block inside

“ tf ho er e v e r ” bl o c k .
c a n o n l y d o i t i f y o ure’ g o i n g u p .

define Fa l l e n o f f

if y position

Wall j u m p

broadcast GameOver

W h e n y o u t o u c h a w a l l, y o u c a n j u m p

up again. Ninja-type charac ters often

h a v e t h i s p o we.r Is t n’ o t v e r y r e a l i s t i c

b u t ist l ’o t s o f f u n !

when I receive GameOver

stop other scripts in sprite


key l e f t a r row pressed? or direction of Gamepad < -35

This block makes the

when c l i c ke d

dog face to the right

set rotation style left-right

a t t h e s t a r t.

set size to 50 %

point in direction 90

g “T h ebo lto”o c k p l a c e s t h e

d o g o n t h e r e d s q u a r e.

show

forever

The dog appears in front

o f t h e r e d s q u a r e.

go to Playe r B l o c k

go to front laye r

if then

point in direction –90

The dog faces left if the

l e f t a r r o w k e y i s p re s s e d .

next costume

if then

point in direction 90

next costume

n“T he xe t c o s t u mb leo” c k s

a n i m a t e t h e dso gw’ a l k .

key r i g h t a r row pressed? or direction of Gamepad > 35


G A M E D E S I G N

Collision detection

Bumper sprites
Collision detection – knowing when and how

two objects are touching – is a big programming


uoY c a n s u r r o u n d t h e p l a y e r w i“ tbh u m p e r ”

c h a l l e n g e w h e n b u i l d i n g g a m e s Thi
. s book sprites that move with it and detect collisions in

e a c h d i r e c t i o n . K n o w i n g w h i c h d i r e c t i o n y o u’ve
m o s t l y u s e s s i m p l e c o l l i s i o n d e t e c t i o n , b u t Dso g’

hit something allows


Dinner uses a collision-detec tion sprite.

you to bounce off it

c o r r e c t l. y E x t r a s p r i t e s

Simple collision detection

and code blocks

This method simply checks whether the player

are needed for this

s p r i t e i s t o u c h i n g a h a z a r d. Is t f ’i n e f o r s i m p l e

type of detection.

g a m e s , b u t w i t h o u t e x t r a c o d e y o u d o n ’t k n o w

w h i c h p a r t of the player is touching and

h o w m u c h i s o v e r l a p p i n g.
UB
M
!P

And animating the sprite

may mean its paws stick

Mathematical collision detection

out when you swap

If you know where everything in the game

c o s t u m e s , c r e at i n g

is and exactly what size it is, then by using

false collisions.

c l e v e r m a t h s y o u c a n wo r k

out when and how things

Collision-detection sprite

h i t e a c h o t h .e rB u t b e

U s i n g a s i m p l e r e c t a n g l e w i t h a n a n i m a te d s p r i t e

warned: this can get

on top (like our red square and blue dog) avoids

r e a l l y c o m p l i c a t e d,

the problem with costumes, because the

as you can see below!

P l a y e r B l o c k i s a l w ay s t h e s a m e s h a p e

a n d s i z e . B u t yo u s t i l l d o ’nt
UB
M
!P

know which par t of it has been

if sqrt((dogx–jellyx)^2+(dogy–jellyy)^2) <

t o u c h e d . P ro g r a m m i n g t r i c k s

(dogR+jellyR) then BUMP!

like our reversing code can

s o l v e s o m e o f t h e p r o b l e m s.
Delete the dog2-a and

dog2-b costumes, because

you only need dog2-c.

A d d t h e s e t w o co d e b l o c k s t o

33

make Howling Dog appear

when the game ends.

when c l i c ke d
when I receive GameOver

hide
go to Playe r B l o c k

set size to 50 %
go to front laye r

set rotation style d o n' t r o t a t e


point in direction 0

show

start sound oWl f H o w l

A d d t h e s h o r t code below to the

43

original Dog2 sprite (not the new

Howling Dog sprite) to make it va nish

when Howling Dog appears. Run the

Here we go a g a i n !

project and see what happens when

the dog falls off the platform.

when I receive GameOver

hide
Y

0 0

0 0

2 1

– –

oT h e l p s h o w w h e r e t h e p l a t fo r m s g o , t h i s i m a g e i n c l u d e s S c r a tsc ’ h

x y - g roi [Link] e e t h e g r i d w h e n y o u d r aw t h e p l a t f o r m s, s e l e c t t h e s t a g e

i n f o a r e a i n t h e l ow e r r i g h t a n d c h o o s e t h e b a c k d ro p s y m b o l

o p e n t h e b a c k d r o p l i b r a r. y S c r o l l t o t h e e n d a n d c h o o“ Xs .ey -I gt r i d ”

isn’t e s s e n t i a l t o d o t h i s, b u t y o u m i g h t f i n d i t h a n d yYo. u c a n r e p l a c e

t h e x y - g r i d w i t h c o l o u r b a c k g r o u n d s a f te r y o u ’v e m a d e t h e p l a t f o r m s .
0 0

0 0

2 1

– –

▷ Level 3

O n t h e l a s t l e v e l , s o m e p l ay e r s w i l l

be tempted to try to jump over the

d o n u t , b u t si ta’ t r a p ! Ist m’ u c h

easier to collect the first bone and

then go back left to avoid the

d o n u t a l t o g e t h .e r

0 0

0 0

2 1

– –
the sprite on the stage so that platforms will appear

switch costume to

in the correct position when you draw them.

W i t h t h e P l a t fo r m s s p r i t e s e l e c te d , c h o o s e t h e C o s t u m e s t a b a n d

63

t h e n u s e t h e p a i n t b r u s h s y m b o l i n t h e c o s t u m e s m e n u t o c r e ate

t h r e e n e w c o s t u m e s . D e l e t e t h e o l d t e s t p l a t f o r m c o s t u m eT. h e n

u s e t h e r e c t a n g l e t o o l t o d r a w t h e p l a t f o r m s o n e a c h l e v erlT. y to

m a t c h t h e p i c t u r e s o n t h e p re v i o u s p a g e s . D o ’nt wo r r y a b o u t

g e t t i n g t h e m p e r fe c t , a s y o u c a n a d j u s t t h e m l a t .e r

Name each costume.

Costume Level 1

Fill

Filled Outlined

Level 1

397 x 230

Select solid

c o l o. u r

Use the

rectangle tool.

T“ hS ee l e c t ” to o l

lets you select

and move a

platform.

Make sure

you’re i n

“ B i t m a p. M o d e ”

Convert t o V e c to r
Convert t o Vecto r

Make sure the costumes appear in

t h e c o r r e c t o r d e r h euroeY . c a n d r a g

a n d d r o p t h e m t o c h a n g e t h e o r d. re

Costume Level 2

Fill
Level 1

Outlined
Filled

397 x 230

Level 2

313 x 360

Level 3

480 x 279

Convert t o Vecto r
f o l l o w i n g c o d e. Is t a’ l o o p t h a t r e p e a t s fo r e v e r y l e ov e Yl . u

a l s o n e e d t o m a k e t w o n e w m e s s a g e“ Ss t: a r. at“n ”dWi ”n

when c l i c ke d

set Leve l to 1

Level = 4
repeat until

set Bones to 0

broadcast Setup and wait

broadcast Start

LevelOve r = 1
wait until

change Level by 1

b r o a d c a s t Win

When the player completes the game,

t“ h emWi ”en s s a g e i s s e n t .

How it works
T hs awt h’ a t h a p p e n s

when you go looking

This code goes once round the loop for each level

o f t h e g a m eT. h e n i t m o v e s o n t o t h e n e x t b l o c k ,

w h i c h b r o a d c a s t “s aWim ”ne s s a g e t o s a y t h a t t h e

p l a y e r h a s w o n Th
. e first broadcast is the message

,“ Swe ht ui pc ”h g e t s t h e s p r i t e s a n d b a c k g r o u n d i n

position ready fo r t h e s t a r t o f t h i s l e v e l . I t waits for

all the receiving blocks to finish setting up before

m o v i n g o n T. h e n t“hSet a r mt e” s s a g e i s s e n t T. h i s

t r i g g e r s a l l t h e w o r k i n g c o d e b l o c k s f o r t h e l e vel,

w h i c h m o v e t h e s p r i t e s a n d l o o k o u t f o r c o l l i s i o n s.
set RunSpeed to 5

set rotation style d o n’t ro t a t e

Swap the

set Gravit y to –1
green flag

if

header for

t“ hw eh e n I

set Fa l l S p e e d to 0

go to x: –120 y: 135
receive Start ”

message.

forever

Run controls

if

Jump control

go to x: 20 y: 180

Simulate grav i t y

Fall e n o f f

if

uoY a l s o n e e d t o c h a n g e D o sg 2c’o d e s o

go to x: –30 y: 140

14

t h a t si tt ’r i g g e r e d b y t“hS et a r mt e”s s a g e .

w h e n I r e c e i ve Start

when c l i c ke d

set rotation style left-right

set size to 50 %

point in direction 90

show

forever

go to Playe r B l o c k
l i s t t o o p e n t h e s p r i t e s l i b r a r. y Ad d B u t t o n 1 t o

y o u r g a m e a n d c h a n g e i t s n a m e “ tPo.o r t a l ”

T h e p o r t a l n e e d s s o “mS eetup”
code to position

“ L e v e l O ve i sr s” e t t o 0 t o

43

i t c o r r e c t l y i n e a c h l e ve l a n d t o m a k e i t s l i g h t l y

show that the level is not

s e e - t h r o u g h b e f o r e i t o p e n s.
over because the bones

haven’t b e e n c o l l e c t e d.

when I receive Setup

g h “Toh se t ” b l ock

m a k e s t h e p o r t al

set Leve lOver to 0 slightly transparent.

set ghost effect to 50

set color effect to 0

Level
if = 1 then

go to x: 200 y: –40

Level then
if = 2

go to x: 100 y: –150

Level
if = 3 then

go to x: 175 y: –125
touching Player B l o c k
repeat until

S e t t “i nL eg v e l O ve r ”

change color effect by 25

to 1 triggers a

change of level.

set Leve lOver to 1

L I N G O

Flags

“ L e v e l O ve ir s ” a v a r i a b l e t h a t t h e p o r t as l code

uses to tell the Game Control sprite when the

l e v e l i s c o m p l e t e. ( R e m e m b e r t h“ we a i t u n t i l ”

b l o c k i n t h e G a m e C o n t r o l sprite’
s loop? It

m a k e s t h e c o d e w a i t b e f o re s w i t c h i n g t o t h e

n e w l e v e“l L. )e v e l O ve ar l ”l o w s d i f f e re n t p a r t s

o f a p r o g r a m t o c o m municate. Pro g r a m m e r s

c a l l a v a r i a b l e u s e d i n t h i s w a ,y“ aflag”
an d i t

is an alternative to using a message.

W h “eLne v e l O ve ir s ” 0 ( b e c a u s e t h e l e v e l i s n’t

o v e r ) , w e s ay t h a t t h e f l a g i s u n s e t .W h e n

“ L e v e l O ve ir s ” 1 ( b e c a u s e t h e p l a y e r h a s

reached the open portal), we say that the

f l a g i s s e t . M e s s a g e s c a n o n l y s t a r t code

b l o c k s , b u t b y u s i n g a f l a g yo u c a n p a u s e t h e

code in the middle until something happens.

I n t h e G a m e C o n t r o l sprite’
s l o o p , t “h wait
e

u n t bi l l”o c k p a u s e s u n t i l t h e f l a g e q u a l s 1 .
T h e x a n d y c o o r d i n a tes

change Bones by 1

determine where this

bone will appear on the

Level
if = 1

stage at each level of

t h e g a m eT. h e p o s i t i o n s

go to x: –175 y: –95

may not match your

platform designs

exactly, b u t t h e y ’ l l b e

f i n e f o r n o .w

Level
if = 2

go to x: –30 y: –110

if Level
= 3

go to x: –150 y: –65

show

Nothing happens with

this code until the dog

touches the bone.

w h e n I r e c e i ve Start

74

wait until touching Player B l o c k ?

hide

change Bones by –1

The number of

start sound Dog1


bones to collect

falls by 1.
uoY n e e d t o c h a n g e t“hS eetup”
co d e

B O N E 3

94

blocks for Bone2 and Bone3 so that they

a p p e a r i n d i f f e r e nt p l a c e s t o B o n e 1 o n

when I receive Setup

each level. Change the numbers in the

og“b to”
l o c k s t o m a t c h t h o s e s h o w n h e re.

change Bones

B O N E 2

if

when I receive Setup

go to x: 35 y: –70

change Bones by 1

Level then
if = 1

if

go to x: –10 y: 105

go to x: 60 y: –60

Level then
if = 2

if

go to x: –10 y: 80

go to x: 120 y: 140

show
Level then
if = 3

go to x: 0 y: 15

05
show

These blocks test which

level the bone is on and set

its position on the stage.


c o r r e c t s i z e.

when I receive Setup w h e n I r e c e i ve Start

set rotation style left-right forever

set size to 50 % point in direction 9

repeat 35

Level then
if = 1

go to x: 140 y: 35

point in direction –

if Level then
= 2

repeat 35

go to x: 0 y: 15

Level then
if = 3

go to x: 70 y: 30

Add one last bit of code to detect a

54

collision with the PlayerBlock and end the

game – junk food really is bad for you!

w h e n I r e c e i ve Start

wait until touching Player B l o c k ?

broadcast GameOver
broadcast GameOver

uoY n e e d t h r e e c o s t u m e s f o r t h e H a z a r d s

75

s p r i t e . G o “Ct ho o o s e a C o s t u ma te ”t h e l o w e r

l e f t o f t h e w i n d o w a n d s e l e“Ccht e e s y P u f f s”

a s t h e f i r s t c o s t u m e . S e l e c t t h i s b u t to n t w i c e

m o r e t o a d d t “Ca
w o k e s -p”ar i t e s a s t h e

s e c o n d a n d t h i r d c o s t u m e s. D ec l e“ t eo s t u m e 1 ”

from the costumes list. Use the Select tool to

make all the costumes smaller and position

t h e m a s s h o w n h e r eoY. u c a n f i n e - t u n e t h e i r

p o s i t i o n s l a t .e r

Use a bowl of

cheesy puffs

Most of the costume should

in Level 1.

have the checked patte rn

f o r a s e e - t h r o u g h c o l o. u r

Use two cakes Use one cake

in Level 2. in Level 3.
P l a t f o r m s s p r i t e a n d g o t o t h e C o s t u m e s t a b.

U s e t“hS ee l e ct to o” l i n t h e p a i n t e d i t o r t o

m o v e , s t r e t c h , o r r e s i z e t h e Le v e l 1 p l a t fo r m s .

C l i c k o u t s i d e t h e s e l e c t i o n b o x t o s h ow y o u r

changes on the stage. Adjust the platforms

until Level 1 matches page 148.

Use the same method to fine-tune the

95

p o s i t i o n o f t h e H a z a r d s s p r i t e. S e l e c t i t i n t h e

s p r i t e s l i s t a n d g o t o t h e C o stumes tab. Use

t“hS ee l e ct to ”o l t o a d j u s t t h e p o s i t i o n o f t h e

snack in the first costume (which appears in


Fine-tune the

cheesy puffs
Level 1). Click outside the selection box to

using the

check your changes on the stage.

“ S e l e ct ot o”l .

uoY c a n r e p o s i t i o n a l l t h e

60

using their x and y coord

sprite on the stage and d

want. Make a note of its

that appear in the inform

Copy the numbers into the

b l o c k i n t h e s p r ist eL’e v e l 1 c

if

go to x: 35 y: –70

x y
Sprite Sprite1 35 -70

Show S ize 100 Direction 90


appeared automatically in

T h e b os n en ’e w

this block. Now you can

c o o r d i n a t e sa p p e a r

simply drag the block into

automatically in

your code without needing


g t“ h ebo lto”o c k i n

the blocks palette.


t o d o a n y t y p i n g. E a s y !

I f y o u n e e d t o m o ve t h e s l i d i n g d o n u t , uoY s h o u l d n o w h a v e Le v e l 1 w o r k i n g b e a u t i f u lol yT . work

b e a r i n m i n d t h a tg t“h e obto”
lock sets on another level and its sprites, you can make a temporary

16 62

i t s s t a r t p o s i t i o no. Tc h a n g e h o w f a r i t change to the code for the Game Control sprite. Change

slides, adjust the numbers in its two t h e n u m b e r i n st“h eet L e v e l t ”o b l. o Rc uk “nt2ot” h e g a m e

“ r e p e laot o” p s . O n e c o n t r o l s h o w f a r i t a n d L e v e l 2 a p p e a r s o n t h e s t a g e . Fi n e - t u n e y o u r s p r i t e s’

g o e s t o t h e r i g h t , t h e o t h e r t o t h e l e f t. p o s i t i o n s . B u t r e m e m b e r t o c h a n g e t h e n u m b e rs“ i et
n

Levelbto”
a c k “wt1ho”e n y o ur e’ d o n e .

w h e n I r e c e i ve Start

when c l i c ke d

forever

set Leve l to 1

point in direction 90

repeat until

repeat 35

set Bones

move 3 steps

Moves

donut

broadcast Setup

right

broadcast Start

point in direction –90

wait until

repeat 35

move 3 steps
change Score

Moves

donut

left

b r o a d c a s t Win
t h r e e c o d e b l o c k s b e l o .w R u n t h e p r o j e c t t o

c h e c k t h a t t h e c o r r e c t s i gn s s h o w a s y o u p l ay.

when c l i c ke d

COLLECT ALL BONES

T O O P E N P OARLTO

switch costume to Instructions

NEXT LEVEL

go to x: 0 y: 0

W i n

go to front laye r

show

touching Player B l o c k ?
wait until

hide

The instructions vanish

w h e n t h e p l a yse rs p’ r i t e

touches them.

w h e n I r e c e i v e Wi n

s w i t c h c o s t u m e t o Win

Lose

go to front laye r

show

when I receive GameOver

switch costume to Lose

go to front laye r

show
T O O P E N P AO RLOTT

NEXT LEVEL

uoY c a n g i v e e a c h l e v e l i t s o w n m u s i c . S e l e c t t h e G a m e

66 76

Control sprite and load these sounds from the Scratch

s o u n d l i b r a r “y, X y: l o 2 ” “, X y l o 3 ” a“. nX dy l o 4 ” Th e co d e

b e l o w w i l l s w a p t h e m u s i c e a c h t i m e y o u c h a n g e l e vel.

T h e f ir“re spt e laoto”p p l a y s

“ X y luo n2 t” i l t h e p l a y e r

r e a c h e s L e ve l 2 .

when c l i c ke d

Level = 2
repeat until

p l ay s o u n d yXl o 2 until done

68

Level = 3
repeat until

p l ay s o u n d yXl o 3 until done

Level = 4
repeat until

p l ay s o u n d yXl o 4 until done


V i c to r y d a n c e

I f y o u t h i n k t h e e n d o f t h e g a m e i s ’nt e x c i t i n g

e n o u g h , c h a n g e t h e c o d e f o r t“h eWin” message

t o d o s o m e t h i n g m o r e s p e c t a c u l .a rM a y b e t h e

d o g c o u l d d o a l i t t l e v i c t o r y d a n c e ?Wh y n o t

add a new sign for when the dog falls off the

p l a t f o r m s a n d e n d s u p a t t h e b o t to m o f t h e

stage?
o uY c o u l d m a k e t h e d o g d i s a p p e a r t o o .

uoY w o n !

Ls e cte ’l e b r a t e !

Adjust the jump

uoY h a v e t o t a l c o n t r o l o v e r t h e dso gj ’u m puosY. c a n

when c l i c ke d

make him leap higher by increasing the value of the

“ a kTe o f f S p e ev da ”r i a b lueoY. c a n a l s o m a k e t h e v a l u e

set a keT o f f S p e e d to 12

of ”Grav i t sym”a l l e r o r l a r g e r t o c o n t ro l h o w f l o a t y e a c h

j u m p i s Why
. n o t a d d a s p e c i a l l e v e l w i t h r e ve r s e g r a v i t, y

set RunSpeed to 5

s o t h a t g r a v i t y p u l l s you up, n o t d o w nuoY? w i l l n e e d t o

m a k e c o d e c h a n g e s t o s e t t h e j u m p v a r i a b l e s j u s t for
set Gravi t y to –1

t h a t l e v e l w i t h “i af nthen”
block, and also to detec t

w h e n t h e d“of ga lol fs f” t h e t o p o f t h e l e v e l !
Decreasing this number

m a k e s t h e j u m p s l e s s f l o a t. y

G A M E D E S I G N

Designing levels

iTr c k s r T y f o o l i n g t h e p l a ye r i n t o f o l l o w i n g w h a t
D e s i g n i n g h o w a l l t h e c h a l l e n g e s a n d r e wa r d s i n

appears to be an obvious way through a level but then


a l e v e l f i t t o g e t h e r i s a t r i c k y jooubY. n e e d t o p l a n

t u r n s o u t t o b e a t r a pT. h e c o r r e c t w a y w i l l b e a n e a s i ,e r

e v e r y d e t a i l a n d g e t a f r i e n d t o t e s t i t t o s e e i f si t ’

but less obvious, solution.

t o o e a s y o r t o o h a r d. M a k e s u r e y o u c a n c o m p l e t e

t h e l e v e l y o u r s e l f b e fo r e a s k i n g t h e m t o t r y i t .

Timing Are your moving hazards going so fast you

can’t g e t p a s t t h e m , o r s o s l o w t hs e’ re n o c h a l l e n g e ?

A d j u s t t h e i r s p e e d s u n t i l y or ’u e h a p p y w i t h t h e m .

Are your hazards

moving too fast?

ooT l s C o m p u t e r g a m e s o f t e n co m e w i t h l e v e l d e s i g n

Spacing Is the player able to jump from platfo rm to tools that are unlocked once you finish the game.

platform easily – or perhaps too easily? Make the gaps Using these you can cre ate your own challenges and

between the platforms bigger or smaller to suit the p u z z l e s w i t h i n t h e g a m ueoY. c a n u s u a l l y s h a r e y o u r

l evel you’
re d e s i g n i n g . c u s t o m i z e d l e v e l s o n l i n e, s o t h a t o t h e r s c a n t r y t h e m .
G l a c i e r
person with the most gems when

the time runs out.

A I M O F T H E G A M E

I st r’ e d c a r v e r s u s b l u e c a r i n a ra c e - o f f a g a i n s t

t h e c l o c k . Wi n b y c o l l e c t i n g m o r e g e m s t h a n

y o u r o p p o n e n t b e f o re t h e c o u n t d o w n e nds.

E v e r y gem you grab adds an extra second

to the race countdown, but stay clear of the

snow or you’ l l e n d u p i n a s p i n .

Cars

U s e t h e g a m e c o n t r o l s to k e e p

your car on the ice and collect

gems.
o uY c a n a l s o p u s h t h e

other car off the road to gain

an advantage.

Obstacles

Avoid th e g i a n t s n o w b a l l s

and the edge of the road

or you’ l l s p i n o u t o f c o n t r o l.

Penguin

The penguin is the master

of ceremonies. He asks

t h e p l a y enras m
’ es at the

s t a r t , g i v e s i n s t r u c t i o n s,

The red car starts on the left and

and announces the winner

i s c o n t r o l l e d u s i n g t h eW, A , S ,

and D keys on the keyboard.


at the end.
The blue car starts on

the right and is contro lled

w i t h t h e a r r o w k e y s.
1

symbol t o c r e a t e a b l a n k s p r i t e a n d r e n a m e“G i at m. e L o o ”p

T h e n m a k e a v a r i a b l e c a l l“Countdown”
ed fo r t h e g a m e t i m e r

a n d s h o w i t o n t h e s t a g e . B u i l d t h e fo l l o w i n g c o d e to m a k e

t h e g a m e l o o poY. u’ l l n e e d to c r e a t e t h e m e s s a g,“ eS setup”

“Calculate”
, , “Move” a“nGda m e O. v e r ”

Create the variable

“ C o u n t d o w”n in the

when clicked

Vari a b l e s s e c t i o n .

broadcast Setup and wait

Countdown < 1
repeat until

broadcast C a l c u l a te and wait

broadcast Move and wait

broadcast GameOver

U s e “t hb er o a d c a bs lto” c k

to create the messages

broadcast message1

f o r y o u r c o d e.

New message

Name the

message1

message here.

How does it work?

W h e n t h e p r o j e c t r u n s , t h e c o d e s e n d s o u “t S aetup”
message

t h a t t e l l s a l l t h e s p r i t e s t o g e t r e a d y f o r t h e g a m e . I t w a i t s for

them to finish, and then the main loop begins. Th e l o o p s e n d s o u t

messages telling every sprite in the game when to run each part

o f t h e i r c o d eT. h e l o o p e n d s o n l y w h e n t h e c o u n t d o w n re a c h e s 0 ,

a t w h i c h p o i n t t“Gh ea m e O v e rm e” s s a g e i s s e n t s o a l l s p r i t e s c a n

p e r f o r m a n y f i n a l a c t i o n s a n d t h e w i n n e r i s a n n o u n c e d.
sprites each with its own loops

can become slow as the computer

h a s t o c o n s t a n t l y j u m p b e t w e en

them. Using a single game loop

fixes this problem, but be careful

not to use loops elsewhere in the

game as they will slow it down.

C r e a t e t w o n e w v a r i a b l e“ Rs :o a d( Yt o” s t o r e t h e y

coordinate used to p o s i t i o n o u r m o v i n g s c e n e r y)

when I receive Setup

a“Ca
n dr S p e e( dt o” s e t h o w q u i c k l y t h e c a r s c a n

move around the s tage). Uncheck the tick boxe s in

set RoadY

the aV r i a b l e s s e c t i o n s o t h e y a r e ’nt d i s p l a y e d o n t h e

s t a g e . A d d t h e co d e o n t h e r i g h t t o s e t t h e v a l u e s o f

set CarSpeed

the variables at the start of the game.

set C o u n t d ow n

This block sets the time limit

reset timer

f o r t h e g a m e i n s e c o n d s.

Add another variable for all

s p r i t e s c a l l “eRdo a d S p e e d ”

w h e n I r e c e i ve C a l c u l at e

to store the speed of the

m o v i n g s c e n e r. y U n c h e c k

set RoadSpeed to –5

t h e t i c k b o xT. h e n c r e a t e

a code to calculate the

change RoadY by

position of the road each

time the game loop runs.

RoadY
if

uoY’ l l s e e h ow t h i s w o r k s

once you’v e m a d e t h e

change RoadY by 720

road sprites.
m o v e d o w n t h e s t a g e.

Create a new sprite and

4
Costume costume1

. In“Road1”
call
theit

paint editor
, choose the

paintbrush tool and

10

Fill

set the thickness to 1 0.

Draw the edges of the

road and make sure they

run right from the top

to the bottom without

any gaps.
Then use the

fill tool to colour the

area on both sides of the

road white, creating a

snowy setting.

Leave the

r o a d e m p t. y

Convert t o Vecto r

Now duplicate the Road1 sprite to make Road2.

5
Sprite R oad2

Select Road2 and go to the Costumes tab. Click

on“Flip
thevertical”
button at the top right

S h ow

and the road costume will turn upside down.

The edges of Road1 and Road2 will now match

as they are mirror images


T . h e y ’ll look odd on

the stage at the moment, but you’ll fix that later


.

Road1
R o a d 2 t o m a k e t h e s e c o n d r o a d s p r i te w o r k paint the backdrop rather

7 8

together with the first. Run the project – the than the sprites, or else the

road should scroll smoothly down the screen. cars will collide with the road

s u r f ace. Select the stage and

c l i c k o n t h e B a c k d r o p s t a b.

Use the fill tool

when I receive Setup

This makes sure the

w i t h a n i c y b l u e c o l o .u r

s c e n e r y stays behind

go to x: 0 y: 360
the other sprites.

go backward 10 layers

Road2 is positioned above or

below Road1, depending on

where Road1 is on the stage.

when I receive Move

RoadY < 0 then


if

RoadY + 360
go to x: 0 y:

else

RoadY – 360
go to x: 0 y:

M a k e t h e s c e n e r y more interesting by adding some

t r e e s . S e l e c t R o a d 1 a n d c l i c k o n t h e C o s t u m e s t a b.

Create your ow n t r e e s o r b u s h e s u s i n g t h e t o o l s i n

t h e p a i n t e d i t .o rR e p e a t t h e p r o c e s s fo r R o a d 2 .

Create as many trees

as you like and place

them around the road.


t o d r a w a c a r l i k e t h e o n e s h o w n h e r e . M a k e s u re y o u

d r a w t h e c a r f a c i n g r i g h t o r i t w i l l p o i n t t h e w ro n g w a y

in the game. Remember to delete the cat image once

you’ve f i n i s h e d .

Make your race car

a bit bigger than the

Use the circle

cat. Th e n e x t b i t o f

tool to draw an

code will shrink it.

oval s hape.

R e n a m e t h e s p r “i tRee d C ai nr ”t h e s p r i t e s Remember that in this project, sprites can run

1 1 2 1

list. Th e n c r e a t e a n e w v a r i a bs“l ep,,i n n i n g ” code only when they get messages from the

which you’ l l u s e l a t e r t o s a y w h e n a c a r G a m e L o o p . A d d t h e f o l l ow i n g c o d e t o s e t

is in a spin. Note that for this variable, you up the red car at the start of the game.

n e e d t o s e l e c t t h e o p t i“of no r t h i s s p r i t e

o n l ayn ”d u n c h e c k t h e t i c k b o x i n t h e

Vari a b l e s s e c t i o n s o t h a t t h e v a r i a b l e

doesn’t s h o w o n t h e s t a g e .
when I receive Setup

set size to 30 %

New
Va r i a b l e

show

New variable name:

Make sure

go to front

you select

spinning

this option.

go to x: –40 y: 0

For a l l s p r i t e s oF r t h i s s p r i t e o n l y

point in direction 0

Cancel OK

set spinning
key d pressed?
if

This block

moves the

point in direction 30

car sideways.

change x by CarSpeed

key a pressed?
if

point in direction –30

This block makes

change x by CarSpeed
0 –

the car turn a

little to the left.

key w pressed?
if

change y by CarSpeed

This block

moves the car

up the stage.

key s pressed?
if

change y by RoadSpeed

A d d s o m e c o d e t o r u nc t“h e a r c o n t r o l s ”

41

block when the car receives the message

when I receive Move

“Move”
f r o m t h e G a m e L o o p. R u n t h e

p r o j e cuotY. s h o u l d n o w b e a b l e t o s t e e r

car controls

t h e r e d c a r a l o n g t h e r o a d u s i n g t h e k e ys

, WA , S , a n d .D
a n d t h e n c l i“ cMk a k e a B. lNoacmk e” t h e b l o c k

hc“ e c k c o l l i s i o na ns ”d c r e a t e t h e f o l l o w i n g c o d e .

define check collisions

if touching Road1 ? or to u c h i n g Road2

set spinning to 30

This block tells the car

h o w l o n g t o s p i n f. o r

Now create another block, call it

61

, a n “spin
d a” d d t h e c o d e s h o w n

define spin

here. sTh
“ bpin”
el o c k r u n s w h e n

the car is spinning. It turns the

start sound R attle


car round and reduces the

“spin ning”
v a r i a b l e b y o n e W. h e n

turn 30 degrees

t h e v a r i a b l e r e a c h e s z e ro, the

spin ends and the car is reset

change spinning by –1

at the bottom of the stage.

change y by RoadSpeed

if spinning

go to x: –40 y: –180

point in direction 0

This block checks

i f t h e s p i n i s o v. e r
“spin n i ns g m” o r e t h a n

zero, t h e c a r w i l l s p i n .

oT a d d s o m e s n o w b a l l o b s t a c l e s , c r e a t e a n e w s p r i t e

81

i n t h e p a i n t e d i t .o rM a k e i t a b o u t t h e s i z e o f t h e c a r

o n t h e s t a g eoT. g e t t h e c o r r e c t s i z e, w a t c h i t a p p e a r

o n t h e s t a g e a f t e r y o u’v e d r aw n o i tY. u can also see

t h e c o s t u ms es ’i z e i n t h e c o s t u m e l i s t – a i m f o r a b o u t

4 0 x 4 0 . N a m e t h e n e w s p r “i tS en o. w b a l l ”

Costumes
Sounds
Code

Costume Snowball

10

Fill

Snowball

40 x 40

These

numbers

show the

c o s t usm e ’

size.

Use the

“ S etool
lect”

to resize

the sprite.

Convert t o Vecto r
This block hides

the original sprite

so that you only


when I start as a clone

see the clones.

go to x: p i c k r a n d o m– 2 0 0 to 200

show

when I receive Move

RoadSpeed
change y by

y position < –175 then


if

delete this clone

Now select the Game Loop spr ite and add this

02

code to make a new snowball appear with a

chance of one in 200 every time the loop repeats.

Making this number

b i g g e r c r e a t e s f e wer

snowballs.

when I receive Move

pick random 1 to 200 = 1 then


if

create clone of S n ow b a l l
set spinning to 30

Playertwo

uoY n o w n e e d t o c r e a te t h e s e c o n d p l a y e rs car’ .

Doing this is easy – you simply copy the first

car, r e c o l o u r i t b l u e , a n d t w e a k t h e c o d e b l o c k s .

D u p l i c a t e t h e R e d C a r s p r i t e a n d n a m e t h e copy

2
Sprite
“ B l u. eNCoat re ” t h a t t h e d u p l i c a t e s p r i te g e t s i t s

o w n c o p y o f a l l t h e c o d e b l o c k sT. h i s i n c l u d e s a

S h ow

c o p y o f st“ hpe i n n i nv ga ”r i a b l e ( s e t “ tf o r t h i s s p r i t e

o n l y ” ) , w h i c h c a n b e d i f f e r e n t f r o m t h e r e d c s.a r ’

Select the BlueCar sprite and click

32

on the Costumes tab to open the

p a i n t e d i t .o rU s e t h e f i l l t o o l t o

c h a n g e t h e c sa rc’ o l o .u r
point in direction 0

I n t “hDee f i n e c a r c o n t r o l s”

key r i g h t a r row
if
52

c o d e , c h a n g e t“ hkee y

p r e s s ebdl o” c k s s o t h a t

point in direction 30

the blue car can be

s t e e r e d u s i n g t h e a r r ow

change x by CarSpeed

keys on the keyboard.

Then run the game.

Both the cars should race

along the track, but they

key l e f t a r ro w pressed?
if

can drive through each

other at the moment.

point in direction –30

0 – CarSpeed
change x by

key u p a r r ow pressed?
if

change y by CarSpeed


key d o w n a r ro w
Change the code
if

I n t “hkee y p r e s s e db ?l o” c k s ,

r e p l a c ed k”“ e y w“irtihg ht
change y by RoadSpeed

a, r a”kr“ eo yw ”w i“ tl he f t a r, r o w ”

k“ ewyw ui“”tph a, r ar nodw ”

“s”key dwow
i“ t hn a. r r o w ”
touching Road1 ? or touching Road2 ?
if

set spinning to 30

if touching BlueCar ? then

Add these new blocks

broadcast bounce

to the existing code.

This new code makes

RedCar bounce away

f r o m B l u e C. a r

N o w m a k e t h e s a m e c h a n g e s t o B l u e C sa rc’ o d e b l o c k s s o

72

i t c a n s e n s e w h e n i t t o u c h e s R e d C a r a n d b o u n c e. R u n t h e

game to check the cars bounce when they collide.

if touching RedCar ? then

broadcast bounce

T h i s t i m e “t ht oe u c h i n g ”

block checks for collisions

w i t h t h e r e d c. a r
create a new sprite with

t h e p a i n t e d i otT.o cr r e a t e

Fill

a gem, use the line tool to

draw six triangles arranged

in a hexagon. Fill each one

w i t h a d i f f e r e nt s h a d e o f

green. Make it similar in

size to the snowball.

Name the

. s p r“ iGt e m

Gem

40 x 33

C r e a t e t w o v a r i a b l e s“ R–e d C a r G e ma nd
s”

92

“ B l u e C a r G e m( bs o” t h f o r a l l s p r i t e s ) – to when I receive Setup

tally how many gems each car collects.

set RedCarGems

Now add these code blocks to the Gem

s p r i t e ; t h e yre’ s i m i l a r t o t h e c o d e b l o c k s

set BlueCarGems

f o r t h e s n o w b a l l s.

go to front layer

hide

when I start as a clone

go to x: pick random –200 to 200

set color effect to pick random –100 to 100

show
start sound Fairydust

change RedCarGems by 1

change C o u n t d ow n by 1

delete this clone

touching BlueCar ?
if then

start sound Fairydust

change BlueCarGems by 1

change C o u n t d ow n by 1

delete this clone

if

y position
< –175

delete this clone


pick random 1 to 20 = 1
if

The chance of a new gem is 1 in 20, making

create clone of Gem

g e m s 1 0 t i m e s m o r e c o m m o n t h a n s n o w b a l l s.

uoY’ l l n o t i ce t h a t t h e

23

c o u n t d o w n i s n ’t w o r k i n g

when I receive Calculate

and the game never ends.

oT f i x t h e p r o b l e m , a d d t h e

if timer >

code on the right to the

Game Loop sprite and tr y

change C o u n t d ow n by
t h e g a m e a g a i n . Wh e n t h e

c o u n t d o w n r e a c h e s zero,

reset timer

the game should stop.

if Countdown

Ti“hf i tshbelno”c k p l a y s

start sound Pop

s“pop”
ounds in the last

10 seconds of the game

t o w a r n t h e p l a y e rs

time is running out.

First , c r e a t e f o u r v a r i a b l e s f o r a l l

Penguin in charge

33

s p r i t “eRs e: d N a m e ” a“ nB dl u e N a m e ”

A proper start and finish can make t o s t o r e e a c h d r i ve s r n’ a m e ; a n d

“ R e d I n f ”o a“nBdl u e I n f ”o to show

a g a m e l o o k m o r e p r o fe s s i o n a l .

e a c h d r i v se rs ’c o r e d u r i n g t h e r a ce.

Add a penguin race official to ask

Then add the Penguin 2 sprite to talk

the players’
n a m e s , s t a r t the race,

t o t h e p l a y e r s, a n d l o a d t“Gh eong”

and announce the winners.


s o u n d f r o m t h e l i b r a r y to Pen g u i n 2 .
ask R e d d r i v, e yr o u r c o n t ro l s a r e t h eW, A , S , a n d D k e [Link] ayt o’ u r n a m e ? and wait

set RedName to answer

ask B l u e d r i v, e yr o u r c o n t ro l s a r e t h e a r r ow keys.W hs ayto’ u r n a m e ? and wait

set BlueName to answer

say Go! for 1.5 seconds

hide

show variable RedInfo

These blocks show

t h e p l a y se cr so’ r e s

on the stage.
show variable BlueInfo

reset timer

E X P E R T T I P S

The ask and answer blocks

A s p r i t e c a n p u t a q u e s t i o n t o t h e p e r s o n a t t h e c o m p u te r b y u s i n g ta“h es k ”

b l o c k . A n y t h i n g t y p e d a s t h e r e p l y i s s t o r e d i n tah“ en s w ebr l”o c k , w h i c h c a n

then be used inside other blocks just like a variable can.

£ 1 0 0 ? ? T hs a t ’

How much is

daylight ro b b e r y !

when
t h e c a c tus juice?

ask How much is the cactus juice? and wait

next costume

think

£100
R u n t h e g a m e . H i d e a l l v a r i a b l e s e xc e“Countdown”
pt,

“ R, e ad“nIBdnl uf ”oe I n f ”o b y u n c h e c k i n g t h e i r t i c k b o xes

63

in the aV r i a b l e s s e c t i o n . Th e n r i g h t - c l i c k t h e R e d I n f o a n d

B l u e I n f o s i g n s o n t h e s t a g e a n d c h o o“ sl ea r g e r e a. d o u t ”

oT m a k e e v e r y t h i n g l o o k t i d y , d r a g t h e s i g n s t o t h e t o p

l e f t a n d m o v e t h e c o u nt d o w n t o t h e t o p r i g h t .

Check the tick

boxes to s how the

variables on the stage.

Ben Gems: 20

Countdown

Laura Gems: 13
start sound Gong

Type a s p a c e b e f o r e

go to x: 0 y: 0

t h e wo“ wr di n s ! ”

go to front laye r

if RedCarGems > BlueCarGems

RedName wins!
say join

else

if RedCarGems < BlueCarGems

BlueName wins!
say join

else

S i n c e t h e o n l y p o s s i b i l i t y l e f t i s a d r a, w

s a y s Iat ’d r a rwT! y again.

you don’t n e e d t o a de d “ a n q u ab l ls o” c k .

F i n a l ,l y a d d s o m e r h y t h m i c d a n c e

83

m u s i c t o m a k e t h e g a m e f e e l f a s t .e r

when clicked

L o“ aDda n c e A r o u ntod ”t h e G a m e

L o o p s p r i t e a n d t h e n a d d t h i s code.

forever

I s t a’ l o o p , a n d e x t r a l o o p s c a n s l o w

e v e r y thing down, but since it only play sound D a n c e A ro u n d

r u n s o n c e e v e r y f e w s e c o n d s i t w o n’t

a f f e c t t h e g a m e p l a. y
S o u n d s t a b . Th e n c l i c k t h e m i c r o p h o n e i c o n i n t h e s o u n d s

m e n u t o m a k e a r e c o rd i n g . R e p l a ce t h e P es“nguin’
as y ”

b l o c k w i t sh“ taa r t s o u nbdl o” c k a n d c h o o s e y o u r r e c o rding.

Click here to make

a recording.

Record

Fine-tuning

oT c h a n g e h o w h a r d o r e a s y t h e g a m e

i s , a d j u s t t“ hC ea r ,S p e e d ” “ R o a d S, p e e d ”

a“Countdown”
nd variables that are set

a t t h e s t aor utY. c a n a l s o a d j u s t h o w l o n g

t h e c a r s s p i n f o r a f t e r a c ra s h , h o w b i g t h e

b o u n c e i s w h e n t h e y c o l l i d e , a n d h ow

o f t e n s n o w b a l l s a n d g e m s a p p reT.a r y t o

Ben Gems: 20 Countdown 11

get just the right balance to make the

Laura Gems: 13

game tricky, but not too hard.

define car controls

point towards RedCar

move

One-player game

Change the scenery

E x p e r i m e n t w i t h a o n e -player version of the game

I s t e’ a s y t o c h a n g e t h e s e t t i n g o f G l a c i e r R a c e b y w h e r e y o u p l a y a g a i n s t a c o m p u t e r - c o n t r o l l e d b l u e c .a r

r e p a i n t i n g t h e s c e noeuYr. yc a n m a k e t h e p l a y e r s F i r s t s a v e a c o p y o f t h e p r o j e c t s o y o u d o ’nt s p o i l t h e

race through a desert canyon or a dirt track in t w o - p l a ye r v e r s i o n . C h a n g e t h e c a r co n t r o l s f o r t h e b l u e

a forest. Remember to change the snowballs to car, a s s h o w n h e r e , a n d t h e n t r y t h e g a m eT. h e b l u e c a r

match your theme. w i l l c h a s e t h e r e d c a r a n d c r a s h i n to i t .


For e x t r a t h r i l l s , yo u c a n m a k e t h e g a m e s p e e d u p a s

p l a y e r s c o l l e c t m o r e g e m soT. d o t h i s , c h a n g e st“h ete

R o a d S p e ebdl o” c k i n t h e G a m e L o o p s p r i t e s o t h a t t h e

variable changes with each gem collected.

G A M E D E S I G N

Camera angles

Game designers often talk about

ct h“ e amera”
in a computer game.

This refers t o h o w t h e p i c t u r e o n t h e

s c r e e n f o l l o ws t h e a c t i o n i n t h e g a m e .

There is no real camera, but if you

imagine a camera capturing the

a c t i o n , y o u c a n t h i n k a b o u t d i f f e rent

w a y s o f s h o w i n g w h as t g’ o i n g o n .

H e r e a r e s o m e c o m m o n c a m e ra

views in computer games.

△ △

Trac k i n g First person

T h i s c a m e r a f o l l ow s t h e p l a y e r This camera shows the view the

around the game. In Glacier player would see through their own

R a c e , t h e c a m e r a fo l l o w s t h e eyes. Fi r s t - p e r s o n g a m e s m a k e t h e

cars, keeping them in view player feel i m m e r s e d i n t h e a c t i o n ,

as the road moves past. r a t h e r t h a n w a t c h i n g f r o m a f .a r


T r o p i c a l

T
Score

A I M O F T H E G A M E

Inrop
T icaluTn e s , y o u h a ve t o l i s t e n

to the drums play and then repeat

t h e e v e r - g r ow i n g t u n e . M a k e a m i s t a k e

a n d t h e g a ms eover
’ . Th e l o n g e r y o u

c a n m a t c h t h e t u n e f o, rt h e h i g h e r

your score.

◁ Listen

The drums play a tune,

s t a r t i n g with a single note

and then adding one new

note each time.

◁ Drums

Press the drums in order

to repeat the tune the

g a m e p l a y s t o y o u.

◁ Game over

Make a mistake and

the game ends. As the

t u n e g e t s l o n g ,e rt h e

g a m e g e t s h a r d .e r
C r e a t e a n e w S c r at c h p r o j e c t a n d

add or create any backdrop you

want. A tropical theme works

well with this game.

Select this icon

to open the

b a c k d r o p l i b r a r. y

Choose a Backdrop

T h e g a m e n e e d s f o u r d r u m s, b u t y o u

can make just one to start with. Delete

t h e c a t s p r i t e a n d a d d t“hDrum”
es p r i t e

f r o m t h e s p r i t e s l i b r a r. y D r a g i t t o t h e

Th e n a“mD er u m

l o w e r l e f t o f t h e s t a g e.

will be given to the

s p r i t e a u t o m a t i c a l l. y
Uncheck their tick boxes. Every sprite

in the game can use these variables.

Now add three variables


“Forthis sprite
. only”

NewVa r i a b l e

4
Call drumColour”
“them
, d, “ rumNote” and

r d “ umNumber”
hT. ese variables will only
New variable name:

store information about the Drum sprite: its

drumColour

number
, its colour
, and which note it plays.

“For
Using
this sprite enables
only” you to

For a l l s p r i t e s

copy this sprite to make more drums later


,

while allowing each drum to havedifferent

values for these variables.

First a d d t h e M u s i c e x t e n s i o n , t h e n b u i l d t h e c o d e

b e l o w f o r t h e D r u m s p r i te . I t s e t s u p t h e d r usm’ n u m b ,e r

c o l o ,u rt h e n o t e i t p l a y s , a n d t h e t y p e o f s o u n d i t m a k e s

(like a steel drum). Run the project to set the variables

a n d w a t c h t h e d r u m c h a n g e c o l o .u r

T h i s d rsu m ’

variable

information
when clicked

is set up in

these three

set drumNumber to 1

blocks.

set drumColour to 100

set drumNote to 60

set color effect to drumColour

set instrument to ( 1 8 ) S t e e l D ru m

This selects the

steel drum sound.


Click here.

Add an input

number or text

My Blocks

R u n w i t h o u t s c r e e n r e f re s h

Make a Block

The new block appears in the blocks palette

7
Make a Block

and a special pink header


d block,
“ efine play

, appearsdrum”
in the code area.

play drum

B u i l d t h i s c o d e b e l o wd t“h e e f i n e p l a y d r u m ”

8 9

b l o c k . Th e n i f y o u u s e tp“hlay
e drum”
block

a n y w h e r e, S c r a t c h w i l l r u n t h i s c o d eT. h e c o d e

w i l l m a k e t h e d r u m g r o w i n s i z e , p l a y a n o te,

a n d t h e n s h r i n k b a c k t o n o r m auolY. c a n t e s t

t h e n p“e lay
w drum”
block by clicking on it.

define play drum

set size to 150 %

play note d r u m No t e for 0.4 b e at s

set size to 100 %


s e l e c t i n g t h e d r o p - down

Dor uTm P l a y = drumNumber then

if

m e n u o n t“hwe h e n I

receive”
block. Choose

play drum

“ N e w m e s s a ga en ”d t y p e

“ Ri ne m o t e C o. n t r o l ”

How it works

Eventually there will be four drums numbered

1 t o 4 ( t h e l o c a l v a r i a b l e d r u m N u m b e r ) . B e f o re

t h e m a s t e r c o n t r o l l e r b ro a d c a s“ Rt se m o t e C o n t r o l ”

set Dor uTm P l a y

it will set the global v a r i a b“ DrumT


l eo Pl a t yo ”

the number of the drum it wants to sound,

broadcast RemoteCo ntrol

a n d o n l y t h e m a t c h i n g d r u m w i l l p l [Link]

w i l l a d d t h e s e s t e p s l a t .e r

MESSAGE

Only Drum2 plays,

b e c a u sder u“i mt sN u m b e r ”

m a t c “h De rsP. ouT ml a y ”

IGNORES YSP L A IGNORES

Drum Drum3

Drum2
Fourdrums

uoY n o w h a v e o n e d r u m co m p l e t e w i t h i t s c o d e b l o c k soY. u c a n c o p y

i t t h r e e t i m e s t o c r e a t e t h e f o u r d r u m s yo u n e e d f o r t h i s g a m e.

D u p l i c a t e t h e d r u m t h r e e t i m e s, t h e n c h a n g e t h e v a l u e s o f t h e

2 1

t h r e e l o c a l v a r i a b l e s a s s h o w n b e l ow t o g i v e e a c h d r u m a d i f f e r e n t

n u m b ,e rc o l o ,u ra n d n o t e . A r r a n g e t h e d r u m s o n t h e s t a g e , o r d e re d

f r o m o n e t o f o .ur

Drum Drum2 Drum3

when c l i c ke d

set drumNumber to 1 to 2 to 3

set drumColour to 100


to 60 to 170

set drumNote to 60
to 62 to 64

Now run the project. Each drum should

31

b e c o m e a d i f f e r e n t c o l o .u rS e l e c t t h e m i n

t u r n t o h e a r t h e m p l a. y I f t h e y m o v e i n s t e a d

of playing, choose the full-screen symbol at

the top right of the stage. Nothing else will

w o r k y e t , b u t s i tg’ o o d t o t e s t t h a t y o ur

d r u m s a l l p l a y c o r r e ctly.
The stage is a good

41 Stage

place to put the master

controller code blocks

a s t h e y d o n ’t b e l o n g

otanoynGo
.esptirto

the stage info area

at the bottom right of

the Scratch window

to choose the stage.

Backdrops

Click here to

add some code

to the stage.

The master controller will keep track

5 1

o f t h e e v e r - g ro w i n g s e q u e n c e o f

drumbeats by storing them in a

n u m b e r e d l i s toT. c r e a t e t h e l i s t ,

New list name:

o p e n t h e aV r i a b l e s s e c t i o n a n d

DrumOrder

c h o o s e t“hMe a k e a L i sb tu ”t t o n .

N a m e“ Di tr u m O r d e– r ”si tg’ o i n g t o

store the order in which the drums

For a l l s p r i t e s oF r t h i s s p r i t e o n l y

will play. C h e c k t h e t i c k b o x s o y o u

can see it on the stage.

Make a List

Tick here to

show the list

DrumOrder

on stage.
Run the code and watch the

DrumOrder

7 1

“ D r u m O r d el irs”t o n t h e s t a g e

slowly fill up. I t w i l l l o o k l i k e

1 4

t h i s , b u t y o u r n u m b e r s won’t

2 3

b e t h e s a m eT. h e d r u m s d o n ’t

play yet because there are no

3 1

b l o c k s t o t e l l t h e m t o.

4 3

5 1

6 2

7 2

+ length 7 =

E X P E R T T I P S

Lists

M a k i n g a l i s t i s a g r e a t w a y to store
Lists are usually

hidden, but you


information, and lots of pro gramming

can display them

l a n g u a g e s u s e t h e m . Th e y a r e h a n d y

on the stage just

f o r a l l s o r t s o f t h i n g s , f r o m c re a t i n g

like variables.

leaderboards and doing complex

calculations to giving sprites a r t ificial

i n t e l l i g e n c e . I nTrop icaluTn e s , w e u s e

o Y u can use a list


a l i s t t o s t o r e n u m b e r s, b u t y o u c a n

to make a sprite say

store word s i n l i s t s t o o .

something random

when you click on it.

when this sprite clicked

say item p i c k ra n d o m 1 to 5 of Insults


“ D r u m O r d el irs”t , s e t t i n g

“DrumT
o Pl a f yr o” m t h e l i s t ,

wait 0.25 seconds

and then sending out the

“ R e m o t e C o n t r mo le” s s a g e .

A d d t h e np“e lwa y s e q u e n c e ”

91
block to the test code.

when c l i c ke d

delete all of DrumOrder

repeat 7

add pick random 1 to 4 to DrumOrder

wait 1 seconds

P l a c e t h e np“ elay
w

s e q u e nbcleo” c k h e r e .

play sequence

E X P E R T T I P S

Broadcast blocks

T h e r e a r e t wo t y p e s o f b r o a d c a s t S c ra t c h b l o c k s The
. y a r e u s e f u l i n d i f f e rent ways.

broadcast Message

broadcast Message

△ △

Broadcast and wait


Broadcast

T h i s s e n d s t h e m e s s a g e b u t t h e n c o n t i n u e s s t r a i g ht This sends the message but then waits until all

r e c e i v i n g c o d e b l o c k s h av e f i n i s h e d b e f o r e r u n n i n g
t o t h e n e x t b l o c k w i t h o u t w a i t i n g T. h i s i s u s e f u l f o r

t h e n e x t b l o c k T. h i s i s u s e f u l w h e n y o u d o ’nt w ant
t r i g g e r i n g a n e v e n t w i t h o u t s t o p p i n g w h sa tg’ o i n g

t h e c o d e t o c o n t i n u e u n t i l s o m e t h i sn gf ’i n i s h e d ,
on, such as launching an arrow without pausing

t h e l o o p t h a t m o v e s t h e p l ay es rs ’p r i t e . such as the drum playing in this game.


Adding notes to the tune

when clicked

S o f a r y o u ’v e j u s t b e e n t e s t i n g t h e

d r u m s . I st n’ o w t i m e t o g e t t h e m

set Score to 0

playing the sequences needed in

delete all of DrumOrder

the game, starting with one note

and adding another note each time

forever

t h e p l a y e r r e p e a t s t h e t u n e c o r r e c t l.y

wait 2 seconds

add pick random 1 to 4 to DrumOrder

T h e t e s t c o d e i s ’nt n e e d e d a n y m o r e

12

s o r e p l a c e i t w i t h t h i s oonu’[Link] l n e e d

play sequence

to create another new block called

“ w a i t f o r p l a ye –r i”t s c o d e i s s h o w n

w a i t f o r p l a ye r

i n t h e n e x t s t e poY. u’ l l a l s o n e e d t o

c r e a t e a n e w v a r i a b l e f o r a l l s p r i t e s,

c a l, l“eaScore”
dn d c h e c k i t s o i t

appears on the stage.

A d d a n e w v a r i a b l e c a l l“Co
e dr r e c t Co u ntot ”c o u n t h o w

m a n y d r u m s t h e p l a ye r g e t s r i g h t T. h e n c r e a t e t h i s c o d e,

w h i c h h o l d s u p t h e l o o p w h i l e i t w a i t s f o r t h e p l a ye r t o

get the whole drum sequence right.

define w a i t f o r p l a ye r

set Count to 0

set C o r r e c t Count to 0

wait until Co r r e c t C o u n t = length of DrumOrder


p l a y a n d s e n d t“Ch lei c k emde” s s a g e , h a v i n g p u t t h e i r n u m b e r

“Ci lni c k eT.d D hr ui sm ”c o d e w i l l b e t r i g g e r e d b y t h“Cal ti c k e d ”

m e s s a g e . I f t h e n u m b e r s d o ’nt m a t c h , t h e g a m e e n d s .

when I receive Clicked

This is the

number of

change Count by 1

the correct

drum held

in the list.

if item Count of DrumOrder = ClickedDrum then

change C o r r e c t Count by 1

Create a new

change Score by 1

message

called

else

“ G a m e. O v e r ”

broadcast GameOver

A d d s o m e g a m e - o v e r c o d e to t h e s t a gueoY.’ l l The game is complete. N o w t r y playing it, but

52 62

n e e d t o l o a d t“hBell
eo sl oTl ”u n d t o t h e s t a g e r e m e m b e r t o u n c h e“ cDkr u m O r d ei nr ”the aV r i a b l e s

f r o m t h e S c r a t c h s o u n d l i b r a r. y section of the blocks palette or the player can just

read the correct drum order off the list.

when I receive GameOver

Uncheck the

box to hide

play sound Boe l Tl ll until done

the drum order

f r o m t h e p l a y. e r

stop all
“ C l i c k me de ”s s a g e t e l l s

the master controller

when a drum is selected.

Drum Drum2

skcaH t kdna ae w s

Once everything is

Obey me!

w o r k i n g s m o o t h l, y

you can play aro und

with the code and

t w e a k t h e g a m e t o t r y and

m a k e i t m o r e e xc i t i n g o r

h a r d .e rH e r e a r e s o m e i d e a s .


laT k i n g s h a r k

Try a d d i n g a s h a r k s p r i t e

that swims up and gives

instructions – make him

t a l k u s i n g st“h ae by l ”o c k .

14

Round counter

Create a new global vari able

“ R o u nadn ”d s h o w i t o n t h e

s t a g e . S e t i t t o ze r o a t t h e s t a r t GAME

of a game and increase it by

o n e e v e r y time the player

completes a sequence

OVER!
correctly (at the end of the

master controller lo op).


when I receive Clicked

“ai nf d ” blocks

one inside the

change Count by 1

other when

if item Count of DrumOrder = ClickedDrum then


t h e y s h o u l d n ’t

be? Or are

change C o r r e c t Count by 1

they one after

another when

change Score by 1

they should

be inside? else

broadcast GameOver

go to Launcher

Have you

confused similar

b l o c k sg ol “i k e Is a loop that

ot” “apnodi n t should be around

towards”? the blocks missing?

x
Sprite Drum 20

Show S ize 100 Direction

If a sprite

disappears from

the stage, check

is tn ’o t h i d d e n –

select the sprite

Drum Drum2

in the sprites list

and click the

“showi c o ”n .

Try s h o w i n g k e y v a r i a b l e s o n t h e
ClickedDrum

s t a g e b y c h e c k i n g t h e i r t i c k b o xe s i n t h e

orange aV r i a b l e s s e c t i o n . I f t h e i r v a l u e s

DrumT
o P lay

l o o k o d d o r d o n ’t c h a n g e , t h e y m i g h t

g i v e y o u a c l u e a b o u t w h sa tw’r o n g .
to the Scratch website at www. s c r a t c h . m i t . e d u

and select Explore.

Select this option to

s e e s h a r e d p r o j e c t s.

Create E x p l o re Ideas About


Search

S C TCH
RA

Explore

Projects St u d i o s

All Animations Ar t Games Music St o r i e s u Tto r i a l s

Doom on the Broom


Remix

byWork i n g W i t c h 1 1 1

Notes and Credits

D e f e n d t h e w i t c h a g a i n s t c re a t u r e s o f t h e

night by turning her broomstick (co mputer

mouse or your finger if using a tablet) and

c a s t i n g f i r e b a l l s ( s p e l l b u t t o n ) . Fl y i n g h i p p o s

g i v e e x t r a l i v e s b u t m a k e s u r e you don’t h i t

them with fireballs!

Jan 27, 2023 Report Add to Studio


1072 801 16 7834
t h e m . D o n ’t j u s t k e e p y o u l i k e i n y o u r b a c k p a c k , s o y o u c a n r e u s e t h e m l a ter.

notes about new games

– write down ideas about

smaller details such as

c h a r a c t e r s , o b j e c t s , l e v e ls,

and actions.

Code your g a m e seT t i n g

3 4

S t a r t w i th the basics. Begin by coding the main Once you’


re h a p p y w i t h t h e g a m e , a s k s o m e o n e

c h a r a c t e r s o i t w o r k s w i t h yo u r c h o s e n c o n t r o ls e l s e t o p l a y i tT. h e y m i g h t f i n d p r o b l e m s t h a t y o u

( k e y b o a r d , m o u s e, o r o n - s c r e e n c o n t r o l l e r )T. h e n m i s s e d b e c a u s e y o u k n o w t h e g a m e t o o well. Fi x

b u i l d u p s l o w l, y a d d i n g o n e s p r i t e a t a t i m e a n d any bugs and make sure it all runs smoothly.

cerantigthecodnteiedtosplaytisparnhtiegame.

Share it!

G o t o t“hS ee e P r o j e c t P abge”
utton at the top of

See Pro

t h e S c r a t c h e d i t o r a n d a d d a fe w w o r d s t o e x p l a i n

h o w t o p l a y t h e g a m [Link] e n s e l e“ cS thare”
to allow

t h e w h o l e w o r l d t o p l a y y o u r m a s t e r p i e c [Link] l l

done, you are now a game maker!


, “Score”
to ma

when I start as a clone

set x to 240

forever

t h e g h o ss t ’

next costume

costume loop

set ScreenEdge

wait 1 seconds

set x to

△ △

Comments No unexplained numbers

u o Y canaddcommenotasnybolckotexpanlyioucord.e Avoid wri t i n g c o d e t h a t c o n t a i n s u n e x p l a i n e d

o T dothujsi,grthtec-oik(lrngp-’yerofsiuusniga n u m b e r soT. m a k e y o u r c o d e e a s i e r t o read,

t a b l e t ) o n i t a n d s eAl e“ c td d C o m. Thmi es ncta”n h e l p add a comment or use a variable so the

r e m i n d y o u w h e n y o u r e a d c o d e w r i t t e n a w h i l e a g o. number explains itself.

Drag and drop

▽ a code block or

Backpack

s p r i t e t o c o p y it

T h e b a c k p a c k i s a f e at u r e f o u n d a t t h e b o t t o m

to the backpack .

o f t h e S c r a t c h s c r e e n . I t l e t s y o u s t o re u s e f u l

c o d e b l o c k s , s p r i t e s, s o u n d s , a n d c o s t u m e s

and move them from project to project. But

remember that you can only use it online.

Backpack

sound costume costume

Scream2 monkey-a Underwater 2


go back to the

Tuto r i a l s

t u t o r i a l l i b r a r. y

A video

explains every

concept in

detail.

E X P E R T T I P S

Making your project different

Scratch projects often look and sound similar if you only use

r e s o u r c e s f ro m t h e S c r a t c h l i [Link] m a k e y o u r s d i f f e rent,

i m p o r t y o u r o w n i m a g e s a n d s o u n d s i n t o S c r a tc h .

▷ ▷

o Y ur own images o Y ur own sounds

Camera

uoY c a n i m p o r t a n y i m a g e uoY c a n r e c o r d y o u r o w n

i n t o S c r a t c h , b u t d o n’t music and sound effects

Select this icon

s h a r e a p r o j e c t co n t a i n i n g t h r o u g h y o u r c o m p u te s r ’

to use your

photos of people you microphone and edit them


webcam to

take a picture.
[Link] u c a n a l s o c r e a t e i n S c r a toc hY. u can also find

your own images with a free music and sounds on the

graphics program or the w e b t o u s e i n y o u r g ames.

paint editor in Scratch.


g a m e s a n d h o w t h e yre’ c reated. Th e f o l l o w i n g

activities will expand your imagination and

stimulate your game- design brain.

Play games

Playing games can trigger ideas for new

ones.r T y o u t d i f f e r e n t g a m e s a n d w a t c h o t h e r

p e o p l e p l a y i n g t h e m T. h i n k a b o u t t h e a c t i o n s

(mechanics), rules, and goals that make a good

g a m e w o r k . I m a g i n e h o w y o u m i g h t co d e t h e s e

d i f f e r e n t p a r t s o f t h e g a m e y o u r s e l. f

▷ ▷

Explore
Find stories

gaming history

I d e a s f o r g a m e s a n d t h e c h a r a c t e rs

Find out m ore about the


i n t h e m o f t e n c o m e f r o m s to r i e s .

h i s t o r y o f g a m i n g Vis
. it a
Next time you watch a good film or

read a good book, think how you video game museum or

a v i n t a g e a r c a d eT. h e re
might turn it into a game.

are lots of free online

versions of famous video

g a m e s , s o s i te’ a s y t o t r y

c l a s s i c g a m e s t h i s w a. y

Think visually

Thinking visually is a vital sk ill for a game

d e s i g n .e rP r a c t i s e d ra w i n g o r t r y m a k i n g

m o d e l soT. h e l p c r e a t e a n i m a t i o n s, f i l m

someone walking and then pause the video

during playback to see their posture changing.


website. Le a r n e v e r y t h i n g

you can about Scratch and

you’ll b e a b l e t o c o d e t h i n g s

you never dreamed possible.

Learn another language

Scratch is a great springboard to learn other

programming languages, such as Python or

J a v a S c r i p t T. h e r e a r e l o t s o f o n l i n e co d i n g

c o u r s e s , i n c l u d i n g s o m e t h a t fo c u s o n

games. Python has a great add-on called

P y g a m e t h a t h e l p s y o u c re a t e g a m e s .

Try a g a m e e n g i n e

uoY don’t h a v e t o b u i l d c o m p u t e r

g a m e s f r o m s c r a t c h – yo u c a n u s e

programs called game engi nes to

do a lot of the difficult coding for

you.
o uY c a n f i n d g a m e e n g i n e s

o n l i n e . M a n y c a n b e t r i e d f o r f r e e.

E X P E R T T I P S

Game engines

A game engine is a program and to guide sprites around the

t h a t c o n t a i n s r e a d y - m a d e code screen. Solutions to problems

for building games. It works a bit caused by collision detection

l i k e S c r a t c h , b u t si t d’ e s i g n e d f o r and game physics are built in.

p r o f e s s i o n a l g a m e d e ve l o p e r s G a m e e n g i n e s c a n a l s o c o n ve r t

rather than beginners learning to games to run on consoles and

c o d e . G a m e e n g i n e s p ro v i d e e a s y mobiles, saving you the bother

ways to detect controller inputs o f r e w r i t i n g a l l t h e c o d e.


employ specialists to work as a team. On smaller games,

each person usually has more than one job. On a big

p r o j e c t , t h e r e m i g ht b e d o z e n s o f p r o gr a m m e r s a n d

a r t i s t s , each working on just a s m a l l p a r t of the game.

△ △

Writer Game designer

The stories and characters in a game T h e g a m e d e s i g n e r c r e a te s t h e

are developed by writers. In a game r u l e s , g o a l s , a n d m e c h a n i c s t h at

w i t h c u t s c e n e s ( s h o r t, m o v i e - like make a game interesting and fun

s e q u e n c e s ) , t h e w r i t e r i s r e s p o n s i b le for playe rs. Playabil i t y i s t h e

f o r w h a t t h e c h a r a c ters say. d e s i g n se rm’ a i n f o c u s .

L I N G O

Game types

Indie games S h o r t f“i on rd e p e n d e n t

,g ta hmeesse” a r e c r e a t e d b y p e o p l e

working on their own or by small teams.

Many featu re creative n e w i d e a s n o t s e e n

in mainstream games.

AAA games These are the biggest games

Composer
and are expected to sell millions of copies.

T h e y t a k e m a n y m o n t h s o r e ve n y e a r s t o

A composer is a professional

make and have huge teams and budgets

musician who writes new

of many millions of dollars.

music. Good music is vital as

i t h e l p s c r e a t e a t m o s p h e re

in a game.
g a m e s a l l d a, y b u t si ta’ s e r i o u s a n d i m p o r t a n t
ideas and building blocks

p a r t o f d e v e loping a game. A tester has to


created by the team and

play the game over and over to check if it


use them to write code

w o r k s c o r r e c t l y a n d i s n o t t o o e a s y o r h a r d.
that makes the game work.

G A M E D E S I G N

Game development

Games go through lots of From blocks to riches

d i f f e r e n t ve r s i o n s b e f o re t h e f i n a l

In 2009, Swedish programmer Markus

o n e i s r e l e a s e d f o r s a l e The
. early

“Notch”
Persson r e l e a s e d t h e f i r s t

versions take the game from a

v e r s i o n o f M i n e c r a f t, a b u i l d i n g g a m e

basic idea to a finished product

dhe’m a d e . B y 2 0 1 4 , M i n e c r a f t h a d

and usually follow the sequence

around 100 million registered users and

shown here. was sold to Microsoft for $2.5 billion.

Prototype Alpha

1 2

The prototype is an The alpha version has all the

experimental version of m a i n f e a t u r e s, b u t t h e y m i g h t

the game built to see if n o t b e f u l l y w o r k i n g T. h e y a r e

the basic idea works and improved and major bu gs are

i s f u n t o p l a. y fixed befo r e t h e n e x t s t a g e .

Beta Release

3 4

The beta version of the T h e r e l e a s e i s t h e f i n a l ve r s i o n ,

g a m e h a s e v e r ything, but it fully tested and fixed. Some

needs polishing and still has g a m e s a r e a v a i l a b el e “ a s a r l y a c c e s s ”

minor bugs, which need to r e l e a s e s f o r f a n s t o t e s t b e f o re t h e

b e f o u n d a n d f i x e d. game is 100 per cent finished.


G l o s s a r y

a n d I n d e x
n a m e d a f t e r t h e i n s e c t s that program can re act to, such

got into the wiring of early as a key being pressed or

a r t i f i c i a l i n t e lligence (A I )

c o m p u t e r s , c a u s i n g e r ro r s . the mouse being clicked.

P r o g r a m m i n g to m a k e

characters such as enemies

camera execute

in a game appear to behave

run
T h e i m a g i n a r y camera See .

i n i n t e l l i g e n t w a y s.

through which a player

views a game.
export

assets

o T send something to the

All the pictures and

code
computer from Scratch, such

sounds used in a game.

as a sprite or a whole project


A stack of instruction blocks

saved as a computer file.

under a header block that

backdrop

a r e r u n i n o r d. e r

The picture behind

file

the sprites on the

collision detection
A collection of data stored

stage in Scratch.

with a name.
Programming t h a t d e t e c t s

when two objects in a

backpack

flag
game are touching.

A s t o r a g e a r e a i n S c ratch

A variable that is used

t h a t a l l o w s y o u to c o p y

condition
to pass information

t h i n g s b e t w e e n p r o j e c t s.

from one sprite or


“ t rAu e o r f a lsst ea ”t e m e n t

c o d e b l o c k t o a n o t h. e r

used to make a decision

block

in a program. See also

An instruction in Scratch

function
Boolean expression
.

that can be joined to other

Code that carries out a

blocks to build code.

console
specific task, work ing like a

p r o g r a m w i t h i n a p r o gram.

A computer that is used

Boolean expression

A l s o c a l l e d a p r o c e d u r e,
j u s t f o r p l a y i n g g a m e s.

A statement that is

subprogram, or subroutine.

either true or false,

costume

leading to two possible

game engine

T h e p i c t u r e a s p r i t e shows

outcomes. Boolean

A program that helps a

on the stage. Rapidly

blocks in Scratch

programmer to make games

c h a n g i n g a s p r si t ec o’ s t u m e s

are hexagonal rather

by providing re ady-made

can create an animation.

than rounded.

c o d e f o r m a n y co m m o n

g a m e f e a t u r e s, s u c h a s

data

a n i m a t i o n , c o n t r o l s,

I n f o r m a t i o n , s u c h a s t ex t ,

and game physics.

symbols, or numbers.
t h e c o m p u ts e fr i’ l e s . o r b e c o m e i n v i s i b l e. procedure

Code that carries out a

index number

memory specific task, work ing like a

A number given to an item p r o g r a m w i t h i n a p r o gram.

A computer chip inside a

in a list. Also called a function,

computer that stores data.

subprogram, or subroutine.

input

message

program

Data that is entere d into a

A way to send information

A set of instructions that a

c o m p u t. e Kr e y b o a r d s , m i c e,

between sprites.

c o m p u t e r f o l l o ws i n o r d e r

and microphones can be

to complete a task.

used to input data.

network

A g r o u p o f i n t e r co n n e c t e d

programming language

integer

computers that exchange

A language that is used

A w h o l e n u m b. e Ar n i n t e g e r

data. Th e i n t e r n e t i s a

to give instructions to

does not contain a decimal

giant network.

a c o m p u t. e r

point and is not written as

a fraction.

operating sys tem (OS)

project

The program that controls

i n t e r f ace

Scratch’
s n a m e f o r a p r o gr a m

e v e r y t h i n g o n a c o m p u t, e r

The means by which the and all the assets that go

s u c h a s Wi n d o w s , m a c O S ,

u s e r i n t e r a c t s w i t h s o f t ware with it.

or Linux.

GUI

or hardware. S e e .

operator random

library

A Scratch block that uses A function in a computer

A collection of sprites,

data to work something p r o g r a m t h a t a l l o ws

costumes, or sounds that can

out, such as checking u n p r e d i c t a b l e o u t c o m e s.

b e u s e d i n S c r a t c h p r o gr a m s .

whether two values are Useful when creating games.

equal or adding two

list

n u m b e r s t o g e t h. e r recursion

A c o l l e c t i o n o f i t e m s s t o re d

C r e a t i n g a l o o p b y te l l i n g

i n a n u m b e r e d o r d. e r output

a f u n c t i o n t o c a l l i t s e l. f

D a t a t h a t i s p r o d u c e d by

local variable

a computer program and

run

A variable that can be v i e w e d b y t h e u s. e r

The command to make

changed by only one sprite.

a p r o g r a m s t a r t.

Each copy or clone of a sprite

has its own separate version

Scratcher

of the variable.

Someone who uses Scratch.


76

algorithms 66 b l o g s , g a m2i n12g Circle Wars

a l p h a v e r si5o n1s 2 b o a r d g a m e s6 1 adding a timer 85

“and” b l o c k 9 9 B o o l e a n e x p r essions 84 aim of the game 76 7 –

3 1 1

animation
0 1 , , 1 47 41 ,5, “ b o u n c e ” m e ssage 118 c l o n e s 8 0 –3

2 1 2 b o u n c i n g05,7101 creating the sprites 78

65

and rapid cos tume change b o u n d i n g b o xes h a c k s a n d t we a k s 8 8 – 9

3 1 1 b r a i n g a m e29s 1 i n s t a nt player control 79

185 see also

“answer ” b l o ck s orT p i c aulnTe s i n s t r u c t i o n s 8 67 –

201

a r i t h m e t i c o p e r a t 1o 2r s 1 “ b r o a d c a s t ” b l o c k s 6078, , 1 m a k i n g f r i e n ds a n d e n e m i e s

arrow keys,1 52,


58 10 “ b r o a d c a s t G am e O v e r ” block 79

a r t i f i c i a l i n t e l l i g3e n 1ce 2 17 win or l ose? 8 4 –5

g i v i n g sprites 20 0 “ b r o a d c a s t a n d w a i t ” b l o c k85,1 “cle a n u p ” o p t i o n 83

a r t i 5s t1s 2 102 c l o n e s 2, 567, 7 – 8 0 –3,

185 4 6 82

“ask” b l o c k s bugs , 65, 205, 209 , 1 15

a t m o s p h e r 4e 1 1 5– f i x i n g j u m p i n 4g 1 0 – 24 changing co l o us/i zer 89,

creating 34 b u m p e r s p r i t e41s 6 5 1 1

and music2 359,1 and cost u m e c7h a n1 g e 1

d e s t r o y ing 82

enemy
6 1 83, 1

e x p l o 8s 1i o 1n 9–1

a n d G a m e L o o p s p r 78ite 1
+C 28

m a k i n, g9718
b a c k d r o p l i b r a r y4 1 89, 41 “ C a l c u l a t e ” m e s s a 07g e 1

c l o s e d - i n space 63
b a c k d r o p5 s 1 calculations 20 0

189

adding
2 1 3 4, 1 clubs
camera angles

53

c o d3 i n1g 2
a d d i n g c o l o1 u5 r 1 cameras

c o d e b l o c k s 22
choice 2o3f 1 “car c o n t r o l s ” b l o 7c k 1 85, 10

a c t i vating 23
continually changing colou r c a r d g a m e 6s 1

building 32–3
2 1 1 c e n t r e p o i n t s , s p rites 65,
, 7871

copyi ng 83
creating you r own
23 1 m o v i n4g 1 6

and event s 95
D o gs ’Di n n e4r 18 “chan g e c o l o r ” b ,l o c k 74 89

and mess a g e s 6 8 , 69
D o o m o n t h e 2B r o1 o m 1 “chang e score by ” b l o c k 8 3

p a u s i n55g 1
G l a c i e r Race
73 1 “chan ge size by ” bl ock 89

triggering 95
Jumpy Mon key103 c h a r a c t e 2r s 1

in wrong place 205


painting 62–3 C h e e s e Ch a s e 5 0

c o d e a r e a 26,27
p l a t f o r1 ms5 1 D o gs ’Di n n 2e3r 1

Star Hu n t e r 3,103–4 D o o m o n t h e B 0r o1 o41 ,m5 1 – 6 coding

bugs 46
Tr o p i c aul nT9es
93,1 1 4 G l a c i e r Race16 8

c 3lubs
1 2
x y - g r i d4 1 8 Jumpy Mon key92

164

how it wor k 9s 811 –


backing up a n d l o c a t i o5n 1

i m p r o v i n g y o u r s k i l l13s 2
b a c k p a c k (Scratch),25,26,27 Star Hu nter 30

c o l l e c ti n g
0 209,
12 “che ck collisi o n s ” b l o c k 76, 1 181

5 0 – 73

b o n e s651 7 –
b a l a n c e d space61 CheeseChas e

eg ms82–1 4
“ B e s t t im e ” 8 8 adding e n e m i e s 5 8 , 6 67 –

s t a r s 4 10 –
b e t a v e r s i5o n 1s 2 a d d i n g i n s t r u c t i o n s 73
E

205

debugging 46, “earl y access” v e r s i o5n12s g a m e s to r i e 4,s 1

59

“def i n e ” b l o c536
718k, ,101 e n e m i e2,s 1 22 music

“del ete this clo n e ” b l o ,ck


82,
81 a d d i n g 3 6 , 3 8 – 9, 58,, 6 67 – 79, the ne x t l e v e l

5 1 1 4 2, 1 3 1 1 2 , 1 0–2 5 playabili t y

63

d e s k t o p c o m p u t e r s 25 bet ter 4 4 –5 space

dice 39 clones 83 v i r tu a l r e a l i t y

d i f f i c u l t y level
3 1 s u p e r n a t u r 2a l 1 4 –5 working with the m e s

a d j u s, t72–3,
i n g7488 , 928, , 1 7 “eq ual to” blo c k 6 6 g a m e d e s i g n e r1s 42

9 2161,85, 8 , 2 0 4 “eq u a l s ” o p e r at o r 8 4 l e a r n i n g f2r o m1 2

ex t r a lives
28 1– 9 e r a s e r t o ol 62, 65 g a m e d e v e l o p m e nt

38

d i r e c tions , 39 e s c a p e g a m 7e s 1 game engines

95

“div i s i o n ” b l ock189 events G a m e L o o p sprite


7807,, 1 1

132– 65

Dog’s D i n n e r Events b l o c k s 95 184,87 1

adding a c h a r a c ter145 – 6 events bu t t o n 3 game7 loops1 0,

22

a d d i n g s o u n 4d 1 7 experimenting game over 68, 69, 70, 88 , 9 8 ,

aim of the g a m–233e 1 e x p l o s8i o1 n1s 9–1 6 2 13–20,1 41 ,76 1 4, 5614, 0,

b o n e s f o r t h e d o56
g 17 – 203,
204

creating a g a m e c o nt r o l game physi c s

s p r i 2t e5 1 –3 g a m e p u b l i s h 5e r12s

d r a w i n g t h e p l a t f o r m50s 1 1–5 “ G a m e S p e e d ” v a r 4i a1b l e, 1

f a l l i n g o f f the leve4 l 14 “Fa l l S p e e d ” v a r i a b l e0 1 30,1 1– 8 , 721

f i n e - t u n i ng16 0 1 – 241 games

f i xing the jumping bugs “Fa l l e n o f f ” b l o c k4 14 t a m o s p h e r 4e 1 1 5–

140 – 4 2 false st atements 8 4 C h e e s e Ch a s e

h a c k s a n d t we a k s 164 –5 f i l l t o o l7963, 1 Circle Wa r s

h a z a r d o u s f o o51d 9 f i n e - t u n i n g 4 616, 0,1 18– creating you r own 209

see also

junk foo58d 1 h a c k s a n d t we a k s debugging 46,

m a k i n g t h e l e v e41ls 8 – 9 f i r e w o8r 1k s1 9–1 D o gs ’ D i n n e r

placing t h e p o r t als
5 41 –5 f i r s t - p e r s o n g ames189 f i n e - t u n i n g 4 66, 1 08,1 1– 8

player on a plat f o r m
3 41 –5 f i x e d c a m e r a a n g el189 game ty pes

r u n n i n g a r o u n36d 17 – f l a g5 s5 1 G l a c i e r Race

signs and m usic162–3 “Flip up - d o w n ” b u t ton


72 1 g o o d i n g r e d3 i e1n 2–t s 1

up and dow38n 1 – 4 0 font size 71 how cod i n g w o r k81s 1 9–

011 2– 9

D o o m o n th e B r o o m “ F o r a l l s p r i t e s ” v a r i a b l 95e 1 improving your know l e d g e

a d d i n g e x p l o 8si1o n1s 9–1 “ f o r ” loops 80 2 1of 2

aim of the 1g0a1m e1 1– “ F o r t h i s s p r i t e o n l y ” v a r i a b l 95e 1 jobs making games

bat at 6t71a c 1k 1– “ f o r e v e r ” bl ock 23, 32,35 Jumpy Mo nkey

c a s t i n g f i r e4b 1a l l s 1 “ f o r e v e r ” lo ops 54, 6 6 , 7 2, p l a n n i n g a g a m e8 1

c h a l l e n g e r m o 7d2 e 1 80, 1 8 p l a2y i n1 g 2

controll i n g t h e4 w1i tch 1 friends Star Hu nter

e x t ra lives h i p p28o 1– 9 adding 79 stor ies4, 1

f i n i s h i n g t o u c h26e s71– c l o n i n g 8 02 – testing 20 9

f i r e - b r e a t h i n g d r a g o2 n 1 2–3 ex t r a lives
28 1– 9 r o Tp i c au lnTes

g h o s 4t s2 1 –5 f u n c t i o n3s 1 6 t y p e s o6f 71 1 –
i m a g e s , i m p o r t i n g your own designing n ew16 0 Minecraft 5 12

1 1 2 f a l l i n g o f 41f 4 m o b i l e p h o3n e1s 2

Indie gam
4 e1s 2 f i n e - t u n ing16 0 m o d e l 2l i n g1 2

i n s t r u c ti o n s m a k i n g the14 8 – 9 m o t i o n b l o ck s 7 32,136, 45, 1

and blo c k s 22 a n d p o r t a5l s41 motion sensors

f o r g a m e s 73,, 86 7, – 0712 3, 1 l i n e t o o l56,182 m o u s e, 2 ,5179,,373,


,91370, 77

8162–3, 8 , 2 0 4 l i n e w i d t h co n t r o l 6 0 391

200

and cod e 22 lists and event s 95

w r i t i n g s e q u e n c e s9o8f11 – 0lives
1 1 “move”b l o c k s 39

“is less than” o p e r a t o r 8 4 ex t r a lives


28 1– 9 “ M o v e ” m e s s,57a73,g071e, 1 1

“is more than” o p e r a t o r 8 4 limited nu m b e r o f65 1 771

“ L i v e s ” v a r84i 1a1b 16l ,e5, 11 movement

l 6o s i 1n7g 1 1 , 1 and centr e point4 16

running o ut 26of 1 and cost u m e c 3h a n1 g41e,51

l o c a l v a r i a b l e95s 1 d e t e c t i on 95

J a v a S c r i 3p t 821, l o c a t i o n s , a n d a t m o s p h e 5r e 1 d i r e c tions

j o y s t i c 3k1s 53, l o g i c b l o ck s 9 9 m o d i f ,y 1i n2g 1 12 2

35 371

uJ“ m p c o n t r o l ” b l o41c,39k 01 loops scrolling

j u m p i n38g 1 – 4 0 bugs 205 and space 63

59

a d j u s t i n g t h ejump165 c o4n t r1o l 1 music 2 13,6,1837,1

171

b u g4s 10 – 24 game
07 , 1 i m p o r t i n g your
1 own1 2

t y p e s o f jump4 14 and leve25ls 1 and leve 163


sl

07192– 80

r e p e at , 96 music games
7 1
Jumpy Monkey

see also

adding g r a v i t y 100 1 – and spe ed of g ame187 rT o p i c aulnTe s

a d d i n g s o u n d0 1 3 “ L o o p s ” 95

aim of the game 92–3 “,L o s e7 a986li11f e ”, 11

b a n a n a s a n d t r e e97s– 9 l o s i n g 8 4 –5

game over 012–3

h a c k s a n d t we a k s 106 7 – n a m e s , c h o i c 0eof21

launching the monkey 94 7 – n e g a t i v e c o o r d i n a t e1s 4

playi n g w i t h g r av i t y 104 –5 “ n e s te d i f ” b l o c k 81s 7

Mac compute rs 25 “ n e x t c o s t u m e ” b l o c 4k5 1

“Make a Bl o c k ” b u t t 5o36
7 n, ,11 “ n o t ” block 9 9

691 n o t e s , k e e p i n g2 2120,9

“Make a Lis t ” b u t t o91n 9 n u m b e r p u z z l7e s 1

“ k e y p r e s s e d ” b l o c k 18s 0 master co n t r o l l, e9r 914,1 7 91 8 , n u m b e r s , u n e x p l a i n0e 1d 2

199

keyboard , 202, 204

arrow key31,652,
, 59,1s 1 m a t h e m a t i c a l c o l l i s i o n d e te c t i o n

180 146

control 25–3 maze games 50

see also

and event s 95 Cheese Chase “obje c t o r i e n te d ” l a n g u a g e s 8 2

l e t ter keys
57 69, 11 m a z e m a k i n g 6 0 – 63 o b j e c t2s 1

s h i f t key
16 m e c h a n i c2 s 1 choice o f 22,
23 1

, space
1 1b 3ar1 13 m e m o r, tey s t i n g y o u91r 932, 1 clones 82
S

see also

s l i d e r s 104 –5,70 1
Scratch s a n d b o x g a m e 6s 1

164

p r o g r a m s , r u n ning 23 slow-motion e f f e c t , g e t t i n g rid


s a v i n g 25, 43,

of43 1
p r o j e c t page 73,81 8 , 2 0 9 “say ”81, bl 8o,7c2 k2 014

project s s o u n d d e s i g n e r1s 42
s c a r y f e a t u r e4,s 591

112

m a k i n g t h e m d i f f erent sounds
D o o m on the2 Br10o1o m, 1 1

a d d i 2n g 135,83,03,161, 3,1
sharing 208 0 2 1 142 –, 1–5

p r o t o t y 5p e 1s 2 6 7 1
scenery 21 3

p u z z l e2 s 1 7 , 1 at end of g ame163
c h a n g i n g8 18

P y g a3 m1e 2 a t m o 2s p h1e21er43, 1
making mo re interesting 73 1

P y t h3 o1 n 2 and changi ng levels361


m o v i1n 73
7g 1, 1

C h e e s e Chase 59,72
“score ” b l o c k 4 4

Circle Wa rs 83
score cou nter 42,57

D o gs ’Di
, n7n e4r 161 3
“ S c o r e ” v a r 4i a1b l 202
e, 1

D o o m on the Br
2 8o1o m ,, 1
s c o r 3e s 1

421
q u e s t i o n s , s p r i t e s85’ 1 C h e e s e Chase70

and event s 95
Circle Wa rs79, 8 4 –5

G l a c i e r Race
6 7 18, 1 148,7
G l a c i e r Race18318, 148, 6

i m p o r t i n g your
1 own1 2
h i g h s c o r e 07

Jumpy Mon key103


Jumpy Mon key102–3

music 59
r a c i n g g a m e s6 1 a n d s o u n d s 83

see also

r e c o r d ing your own81 8


Glacier Race Star Hu nter 42–3

a n d s c o r es 83
random block 204 r o Tp i c au lnTe9s 91

22–7

Star H unter 135,


4
r a n d o m d i r e c t i o n c h a n g e s 8 0, Scratch9, 1

s o u n d l i b r a ,r 8 1y424172,
7, , 11
6 17 1 1 , 1 expandingknowledge of

, 671,81 148,7 203


r a n d o m l o c ations
, 72,
6 15798,, 1 0 1 2 11 –

,s p a1c e 1b 3a r 1
7 1 1 exploring 20 8

39

d i s a b l i n 4g 1 0
random numbers , 40 i n t r o d u c i n g 2 2 –3

space in game s
random sequences 200 l e a r n i n g m o r e a b3o u 1t 2

speech bubbles
random speech 200 name of 24

and arit h m e t i c o p e r a t 1o 2r s 1
r a n d o m t i m e 58 old and n e w v e r si o n s 2 5

f o r g a m e i n s t r u c t i o n s7273, 1
r e a d y - m a d e b l o ck s 2 2 online/o f f line 24

speed
r e c o r d i n g y o ur own so unds18 8 , s e t t ing up 24 –5

and atmosph ere4 1


1 1 2 website 20 8

and dif f i c u l t y level 772,


2 1
r e c t a n g l e t o3o l 14 750,
4, 1 window26 7 –

and exci t e m e n t891


r e l e a s e v e r 5s i o 1n 2 S c r a t c h p r o j e c t s we b s i t e 8 8

371

e x p e r i m e nt i n g w i t h 8 8
remixing 208 scrolling

fall sp e e d 0 1 0
“ R e m o t e Co n t r o l ” m e s, s a7g 9e 1 s e l e c t i o n tool 62,16 0

G a m e S p e e d v a r 4i a1b72 le, 11
9,1202, 204 “ S e n s i n g ” b l o c k s 85

80

of haz ards65 1
“ r e p e at ” l o o p s “set c o l o r ” b 5l 1o, c k744

96

of launch 95
“repe at until” b l o c k 5 1 , 99,, 1 “setaFl ls p e e d ” b l o c38k 1

“spin” bl o6 7c k 1
2241 2, 12 4, 1 “set G r a v i t y ” bl ock10 380, 1

“spinning” v a r i 4a b7l 76e, 1, 1 77 1


“reset t i m e r ” b l o c k 85 “set Level to” bl ock1 16

spooky features
r e v e r s e g r a v i t 0y1 165,5 “set s i z e ” b l o c k s, 6238,47

s p o r t s ,g a m 7e s 1 53
“ R e v e r s e Step” va r i a b l2e4 1 “set
a keT o f f S p e e d ” b l o c39k 1
c o l l i s i o n s73 t r e a s u r e h u n t s 30 G a m e S p4 e172e d, 11

orT p i c aulnTes 192–20 5


h a c k s a n d t we a k s 4 6 7 – g l o b a l v a r i ,a b7l e995,s 1 91 8

k e e p i n g s c o r e2–34 a d d i n g notes to the tune gravity s i m u l a t i o n0 1 0 1 –

s e t t i n g thescene 34 202 hiding 10 0,1020, 1 4,18 6

s o u n d e f f e c t s 1 35,4 aim of the g a m–29e3 1 h i g h s c o r e 07

“ S t a r t ” m e s s a g552,10e7 3,1 1 c h e c k i n g t h e player s ’ tune L a u n c h e s20 1

“ s t a r t s o u n d ” b l o ck10183, 8 203 L a u n c h S p e e d 9 4, 95

s t a y i n g alive 40 c o m m a n d i n g the drums L e v e l O v 2e 5r 15554,, 11

“stop a l l ” b l,71ock 37 2–102 20 84 1Lives


1 16,,511

“stop ” b l o c4k 1 4 d e b u g g i n g 2 05 l o c a l v a r i a b l e95s 1

s t o r i e s , g a m 4,e 1 86 , 88 f o u r d r u m9s 81 naming 43

choice 2o3f 1 h a c k s a n d t we a k s 2 0 4 players’ n a m e 85


s1

ideas2 fo1 r 2 make a dru 91m 4 eR d C a r G e m s281

s t r a t e g y g a m7e s 1 m a k i n g your own b l o c 9k 61 R e v e r s eStep


24 1

strings 186 master c o n t r o l l e91r 9 RoadSp e8, e18718d, 91

subprograms 631 remote co n t r o l d r u m9s 1 7–8 R o a 1d Y73


7 1, 1

s u b r o u t i n e36s 1 t wo t y p e s o f v a r i a b l e 95s 1 Round 204

“ s u b t r a c t i o n ” b l o ck18 9 t r u e s t a te m e n t s 8 4 , 9 6 RunSpeed 371

“ s w i tc h c o s t u m e t o ” b l o ck162 “ t u r n 9 0 d e g r e e s ” block 67 4 1 score


,202
79,1 57

see

tweak s h a c k s a n d t w ea k s s e t t i n g r a n g e0 1 4

t w o - p l ayer games61 8 showing o n s t a g 10e 4, 205

adding p l a y e r t79wo 1– 1 8 and slide rs10 4 – 15,07

see also

Glacier Race s p i n4n i n7 g 16 7 , 1 7 , 1 7

t a b l e t s , S cratch app s for 25 for spr ites8 14

“a keT o f f S p e e d ” v a r i a b ,l39e 1 a keT o f f S p e e 3d 1 659,1

561 time 85

t a s k s , b r e a k i n g d own18 r o Tp i c au lnTe95s 1

t e s t5e r 1s 2 U b u n t u c o m p u te r s 2 5 6 “ V a r i a b l e s ” b l o ck42, 43,

t e s t i n g 4 6 , 209 “undo” b u t t o n 57 4 49, 1 9

t e x t tool 8 6 u s e r a c c o u n t , S c r a t ch24 “ V e c t o r M o d e26” 1

d e l wsotnnkecmAg

D o r l i n g K i n d e r s l e y would like to t h a n k : B a h j a N o r w o o d f o r e d i t o r i a l a s s i s t ance and t e s t i n g ;

C a r o l i n e H u n t and Steph Lewis for p r o o f r e a d i n g; and He len Pete r s f o r t h e i n d e x .

D o r l i n g K i n d e r s l e y I n d i a w o u l d like to thank Riji Raj u f o r e d i t o r i a l a s s i s t a n c e ; A b h i j i t D u t t a ,

A a d i t h y a n M o h a n , P r i y a n k a S h a r m a , a n d M a r k Silas for co d e t e s t i n g .

Scratch is dev e l o p e d by the Life l o n g K i n d e r g a r t e n Group at M I T M e d i a L a b . S e e h t t p : /s/ c r a t c h . m i t . e d u

You might also like