Find The Bug
Find The Bug
Find The Bug
Create a game in which you have to find a hidden bug 🐞 on each level. The game will have ‘start’ and ‘end’ screen
backdrops, and a timer ⌚ to show the player how quickly they found the bugs.
You will:
Create levels for your game using next backdrop and when backdrop switches to blocks
Use a forever loop to keep running code blocks
Use the timer variable to let the player know how quickly they found the bugs
More than 2.5 billion people play video games every year. Just think how many people are involved in creating
those games. Would you like a job designing, coding, or testing games for other people to play?
Step 2 Start screen
Working offline
For information about how to set up Scratch for offline use, visit our ‘Getting started with Scratch’
guide (https://projects.raspberrypi.org/en/projects/getting-started-scratch/1).
Add a Backdrop
The Stage has a Backdrops tab instead of a Costumes tab. This is where you can create images for the Stage.
Select backdrop1 and click on the Delete icon to remove the backdrop1 backdrop from your project.
You will not need the backdrop1 backdrop in this project.
Click on Convert to Vector. Now, you will be able to add text that you can move around.
Use the Text tool to add the text Find the bug to the chalkboard:
We used the Marker font in white, but choose the font and colour that you want to use.
Tip: Switch to the Select (Arrow) tool to move your text around. To change the size of the text, grab the
corner of the text and drag it.
Change the name of the backdrop to start, because you will need to select it later in the project.
Tip: If you use names that make sense, it will be easier to understand your project, especially when you
come back to a project later.
Tip: Give your project a name. You might like to include the name of the bug that you have just chosen.
A mistake in a computer program is called a bug. Finding and removing mistakes in computer programs is
called debugging. Grace Hopper is a famous software engineer. Her team once found a moth in their
computer. Their notes say, “First actual case of bug being found.”
Step 3 First level
Add a new backdrop as the first level in your game, and hide
the bug.
Click on the bug sprite in the Sprite list. Add a script to change the size of your bug when the
backdrop switches to Spotlight:
Choose: You can choose a different size and location, if you prefer.
Add a script to your bug sprite to play a Pop sound and switch to the next backdrop when this
sprite is clicked:
next backdrop
Make the game start with the Start Screen
Click on the Stage pane and add this code to the Stage:
when clicked
Click on the bug sprite in the Sprite list. Add a script to set the size of the bug when your
backdrop switches to the start screen:
Add code to make sure that the bug is positioned on the chalkboard every time your backdrop
switches to the start screen:
go to x: 0 y: 30 on the board
Join the blocks back together so that the code blocks are under the when this sprite clicked
block again:
Test: Click on the green flag to test your project. Click on the bug to move to the next backdrop. The bug
should be big on the ‘start’ screen and small on the ‘Spotlight’ level.
Did you forget to join the code back to the when this sprite clicked block?
Step 4 Parrot distraction
You will use a different loop here. A forever loop runs the code blocks inside it again and again. It is the perfect
loop for an annoying parrot that will not stop flying around and getting in the way.
Add code to make the parrot flap around in a distracting way:
when clicked
Tip: If the parrot gets too annoying while you are coding, you can click the red stop button above the
Stage to stop the code from running.
Step 5 Second level
Choose: Choose a backdrop for your second level. We have chosen the Urban backdrop, but you can
choose the one that you like the most.
Tip: Remember that backdrops with lots of colours and details will make the bug harder to find. How
difficult will you make your game?
Drag the blocks away from the when this sprite clicked block to stop them from running when
you click on the bug:
Resize the bug
Add code to set the size of the bug for the second level:
Drag your bug on the Stage to a good hiding place for this level.
Join the blocks back to the when this sprite clicked block so that when the bug is clicked, the
backdrop switches to the next backdrop:
when clicked
forever
go to back layer
Now, your bug will always stay at the back, even if you need to change its position.
Step 6 End screen
Sometimes, just beating a game isn’t enough. Players like to know how they did against other players or
themselves. Can you think of a game that shows you how well you did?
Tip: In Scratch, you can add the same backdrop more than once.
Tip: You rename the backdrop to end to make it easier to understand your code.
Click on the bug sprite and add code to position the bug on the ‘end’ screen:
go to x: 0 y: 30 on the board
Add a timer
How long does it take you to find and click on the bugs? Scratch has a timer that you can use to find out.
The timer block is in the Sensing blocks menu. Add code to make the bug say the timer on the ‘end’
screen:
go to x: 0 y: 30 on the board
Test: Click on the green flag to test your finding skills. How long does it take you to find the bug?
To go back to the ‘start’ screen, click on the bug on the ‘end’ screen.
Add code to make the bug stop saying the timer when you go to the ‘start’ screen:
go to x: 0 y: 30 on the board
Add code to reset the timer when the backdrop switches to the first level:
Test: Click on the green flag and play the game. The timer should reset when you click on the bug on the
‘start’ screen to move to the first level. When you click on the bug on the ‘end’ screen, you should return
to the ‘start’ screen and see that the bug is not saying the timer.
Upgrade your game
If you have time, you can add more levels and more distractions to your game. You could also change the sprite
that is hiding and change the text on the chalkboard.
Play your game and see how quickly you can find the bugs.
Is there someone else who can try your game? How fast can they find the bugs? They will not know
where you have hidden them, so it might take them a bit longer!
Is there anything that you want to change?
You could:
Here are the blocks that you will need to hide the bug on a new level:
set size to 20 %
You could add more parrots or choose another sprite to act as a distraction.
Here is the code that you used for the parrot:
when clicked
Tip: You can drag the Parrot sprite’s code to another sprite to make it faster to create another
distraction sprite.
Completed project
You can view the completed project here (https://scratch.mit.edu/projects/486719939/).
Share and play
Please make sure that you do not share any personal information about yourself when sharing your
Scratch projects.
Give your Scratch project a name.
If you like, you can add instructions in the Instructions box, to tell other people how to use your
project.
You can also fill in the Notes and Credits box: if you have made an original project, you can write
some short comments, or if you have remixed a project, you can credit the original creator.
Click the Copy Link button to get the link to your project. You can send this link to other people by
email or text, or on social media.
Scratch provides the ability to comment on your own and other people’s projects. If you do not want
to allow people to comment on your project, you should turn off commenting. To turn off commenting,
set the slider above the Comments box to Commenting off.
To submit your project to our ‘Find the bug’ Scratch studio for other people to see, please complete this
form (https://form.raspberrypi.org/f/community-project-submissions).
You can also look at the remixes for the Find the bug starter project (https://scratch.mit.edu/project
s/582214723/remixes) to see what other creators have made.