v 3.
0 Tutorials
www.scratch.mit.edu
The Shark Game
In this game, you 1 minute to eat as many fish
as you can, trying to avoid the octopus!
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 1a Create the backdrops
1 Under Stage, choose the
search icon to locate
‘Underwater 2’
2 Under the ‘Backdrops’
tab, select this one and
click the trash icon.
3 Then right-click on this
and select ‘Duplicate’.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 1b Create the backdrops
1 Rename this backdrop
‘Game Over’
2 Select the text icon and
write ‘GAME OVER’ in big
letters.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 2 Create the variables
1 Click on Variables
2 Then click on
‘Make a Variable’
3 Then create these 4
variables
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 2 Code for the stage
1 First click on the Sounds tab and select ‘Bubbles’.
2 Next, click back on the ‘Code’ tab and enter the following...
When the game is
Once the game is started,
started, it will these variables are hidden.
forever play the
sound ‘Bubbles’
When the game is
started, it will
switch the
backdrop to the
original, set the In the forever loop, once the
time gets to 0, the backdrop
time to 60 and will
will change to the ‘Game
forever count Over’ one we created.
down by 1 every 1
These variables will be shown
second. and then all code is stopped.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 3a The shark
1 Delete any existing sprites, and
then select a new one.
2 Select ‘Shark 2’
3 Under the ‘Costumes’ tab,
delete ‘shark2-c’
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 3b The shark
1 Select ‘shark2-b’, as we will now
edit it.
2 Select the
paintbrush, choose the
red colour and size 15.
Now paint the teeth as
shown here.
You’ll learn the reason
for this later on.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 3c The shark
When the game is started, it
will forever check that if the
shark size reaches more than
70, it will stay at 70.
When the game is started, a forever
loop will constantly check if the points
go below 0. (This can happen as the
octopus can dock you points).
If it does, it will set the points to 0.
When the space key is pressed, it
will switch to the costume with
its mouth open for 0.5 seconds.
Then it will go back to its original
costume.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 3d The shark
When the game is started, the variables are set as
follows. The shark’s costume is set to the original.
When it moves, it will only face left to right (won’t flip
upside down) and will start facing 90 degrees (right).
The forever loop will always check what the
shark’s size is and set it to that.
When the left arrow is clicked, he will move 5
steps in that direction. If he gets to the edge, he
won’t go further.
Same for when the right, up and down keys are
pressed.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 5a Fish A
1 Create a new sprite, by selecting ‘Fish’. We’ll create 3 different ones later. Now we will focus on this one.
2 Delete the other costumes (‘fish-b’, ‘fish-c’ and ‘fish-d’)
DELETE
DELETE
DELETE
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 5b Fish A
1 Click on the ‘Sounds’ tab and select the sound ‘Pop’. Now return to the ‘Code’ tab and enter this...
When the game is started, the fish will only go left to
right (not upside down). It will then go to a random
position on the screen.
He will be set to show with its size set to 20%.
A forever loop will make it take 2 seconds to glide to
another random position on the screen every 0.5
seconds.
When the game is started, the forever loop is
initiated, where it is constantly checking that if
the fish comes into contact with the colour red
(which is the colour we made the shark’s teeth),
then you will hear a pop sound and the variables
are changed as shown. The fish is hidden, waits
5 seconds and is then shown at a random
position on the screen.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 6a Fish B
1 Duplicate the fish by right-clicking on it and selecting ‘Duplicate’.
2 Delete the other costumes (‘fish-a’, ‘fish-c’ and ‘fish-d’)
DELETE
DELETE
DELETE
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 6b Fish B
1 Click on the ‘Sounds’ tab and select the sound ‘Pop’. Now return to the ‘Code’ tab and enter this...
The code has changed slightly, as we want
each fish to be a different.
This one will take 1.5 seconds to glide to a
random position on screen, unlike the
previous fish which took 2 seconds.
And if you eat this one, you will score 20
points, unlike the previous fish which
scored you 10 points.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 7a Fish C
1 Duplicate the fish by right-clicking on it and selecting ‘Duplicate’.
2 Delete the other costumes (‘fish-a’, ‘fish-b’ and ‘fish-d’)
DELETE
DELETE
DELETE
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 7b Fish C
1 Click on the ‘Sounds’ tab and select the sound ‘Pop’. Now return to the ‘Code’ tab and enter this...
The code has changed slightly, as we want
each fish to be a different.
This one will take 1 second to glide to a
random position on screen, unlike the
previous fish which took 1.5 seconds.
And if you eat this one, you will score 30
points, unlike the previous fish which
scored you 20 points.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 8a Fish D
1 Duplicate the fish by right-clicking on it and selecting ‘Duplicate’.
2 Delete the other costumes (‘fish-a’, ‘fish-b’ and ‘fish-c’)
DELETE
DELETE
DELETE
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 8b Fish D
1 Click on the ‘Sounds’ tab and select the sound ‘Pop’. Now return to the ‘Code’ tab and enter this...
The code has changed slightly, as we want
each fish to be a different.
This one will take 0.5 seconds to glide to a
random position on screen, unlike the
previous fish which took 1 second.
And if you eat this one, you will score 50
points, unlike the previous fish which
scored you 30 points.
Now because this one is the hardest of all
the fish, if you manage to eat it, you gain 2
seconds on your time.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 9 Duplicate all 4 types of fish
You should now have 1 of all 4 different types of fish.
Now duplicate each of them twice, which will give you 3 of each fish, making 12 in total.
x2
x2
x2
x2
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 10a The octopus
1 Create a new sprite, by selecting ‘Octopus’.
2 Delete the other costumes (‘octopus-b’, ‘octopus-c’, ‘octopus-d’ and ‘octopus-e’)
DELETE
DELETE
DELETE
DELETE
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
Step 10b The octopus
1 Click on the ‘Sounds’ tab and select the sound ‘Boing’. Now return to the ‘Code’ tab and enter this...
When the game starts, it will only face left to right
(not upside down), will wait 2 seconds and (within a
forever loop) his size will be set to 40%.
He will then take 1 second to glide to a
random position on the screen.
This will be repeated every 1 second.
When the game starts, a forever loop will constantly be
checking if it touches the shark. If it does, it will set the
shark’s size back to 25 (small) and dock the points by 10.
It will then make a boing sound
and then wait 1 second.
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!
v 3.0 Tutorials
www.scratch.mit.edu
The Shark Game
All Done!
To make it more of a challenge, why not
make the octopus move faster?
Adjust it however you want and challenge
your friends for top score!
Scan this QR
code for more
Steve Roles sroles81@gmail.com Scratch tutorials!