Professional Documents
Culture Documents
Projects
Drum star
Make a clicker game where you earn beats to play
new drums and bigger venues
Step 1 Introduction
Make a clicker game where you earn beats to play new drums at bigger venues.
You will:
Use variables to store and change numbers and text (words)
ask a question and use the answer to customise the game
Use if...else blocks to make decisions
There are lots of clicker games where you have to click to make progress and buy upgrades that help you go
faster. Have you ever played a clicker game? There are also idle games that keep going even when you’re not
playing them. These games are fun as long as you don’t spend too much time playing them!
https://projects.raspberrypi.org/en/projects/drum-star/print 1/29
02/06/2022, 08:40 Drum star
In this step, you will set the stage for your first gig and
choose a rock star name.
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).
Musicians called DIY artists start recording music from their bedrooms. They produce their own songs by
themselves then release them online for everyone to hear.
https://projects.raspberrypi.org/en/projects/drum-star/print 2/29
02/06/2022, 08:40 Drum star
when clicked
From the Variables blocks menu, click the Make a Variable button.
Notice: The new name variable appears on the Stage and can now be used in the Variable blocks.
https://projects.raspberrypi.org/en/projects/drum-star/print 3/29
02/06/2022, 08:40 Drum star
when clicked
You can ask a question in Scratch, then use a variable to store the answer.
Click on the Sensing blocks menu and add an ask block to your code:
when clicked
ask What's your rock star name? and wait your question
https://projects.raspberrypi.org/en/projects/drum-star/print 4/29
02/06/2022, 08:40 Drum star
when clicked
ask What's your rock star name? and wait your question
Test: Run your project to make sure the variable starts as ??? then updates to your answer.
https://projects.raspberrypi.org/en/projects/drum-star/print 5/29
02/06/2022, 08:40 Drum star
Now that you have tested that the variable changes to the answer, you can drag the last 2 blocks of
code away from the rest of the script. This means you don’t have to type an answer every time you test
your project:
when clicked
ask What's your rock star name? and wait your question
https://projects.raspberrypi.org/en/projects/drum-star/print 6/29
02/06/2022, 08:40 Drum star
You will add a cymbal sprite that you can click to earn beats
and play a sound.
Click Choose a Sprite and search cymbal. Add the Drum-cymbal sprite to your project.
https://projects.raspberrypi.org/en/projects/drum-star/print 7/29
02/06/2022, 08:40 Drum star
The Music section then appears at the bottom of the blocks menu.
https://projects.raspberrypi.org/en/projects/drum-star/print 8/29
02/06/2022, 08:40 Drum star
Add a script to make the cymbal switch costume and play a drum sound:
play drum (5) Open High-Hat for 0.25 beats drum sound
Test: Test your cymbal by clicking on it. Make sure you hear a sound and see the costume change.
The Drum-cymbal sprite will earn you one beat each time you click it.
https://projects.raspberrypi.org/en/projects/drum-star/print 9/29
02/06/2022, 08:40 Drum star
change beats by 1
Test: Test the Drum-cymbal by clicking on it and watch the beats increase.
The beats variable needs to start at 0 beats when you start a new game.
https://projects.raspberrypi.org/en/projects/drum-star/print 10/29
02/06/2022, 08:40 Drum star
Click on the Stage pane and then the Code tab to add code to the Stage.
Add a block to set beats to 0:
when clicked
set beats to 0
Test: Click the green flag and make sure your beats variable starts at 0.
https://projects.raspberrypi.org/en/projects/drum-star/print 11/29
02/06/2022, 08:40 Drum star
You will add your first upgrade. The Get snare button will
show at the start, so the player knows which drum they are
working towards.
Add the Drum-snare sprite to your project and position it on the Stage:
Drag the when this sprite clicked script from the Drum-cymbal sprite to the Drum-snare
sprite.
You can copy code from one sprite to another sprite in the Sprite list:
Both sprites will have the code blocks that you have copied. If you are moving the code from one
sprite to the other, you can delete the code from the first sprite after you have copied it to the other
sprite.
https://projects.raspberrypi.org/en/projects/drum-star/print 12/29
02/06/2022, 08:40 Drum star
play drum (1) Snare Drum for 0.25 beats drum sound
Test: Try out your project. Make sure that you earn 2 beats when you click on the snare drum.
Upgrades are not available when you start the project. They have to be earned with beats.
Add a script to hide this drum sprite at the start of the project:
when clicked
hide
A button will show which drum is the next upgrade option and how many beats it will cost.
https://projects.raspberrypi.org/en/projects/drum-star/print 13/29
02/06/2022, 08:40 Drum star
Change the visibility to Show and change its name to Get snare. Position it in the bottom-right corner
of the Stage:
Click on the Drum-snare sprite and go to the Costumes tab. Use the Select (arrow) tool to highlight the
not hit costume of your drum. Click on the Group icon then the Copy icon:
https://projects.raspberrypi.org/en/projects/drum-star/print 14/29
02/06/2022, 08:40 Drum star
Click on your Get snare sprite and Paste the snare costume. You might need to resize and position it to
fit your button:
Click on the Code tab and add a script to show the Get snare sprite at the start of the project:
when clicked
show
The upgrade can only be bought if the user has 10 or more beats. In Grow a dragonfly (https://projects.raspberr
ypi.org/en/projects/grow-a-dragonfly), you learned about making decisions with if blocks.
An if ... else block is used to make a decision and will do different things if a condition is true or false.
We use if … else all the time to make decisions. When you wake up, you check if it is morning. You get up, or
else you go back to sleep. Can you think of any if ... else decisions you make?
https://projects.raspberrypi.org/en/projects/drum-star/print 15/29
02/06/2022, 08:40 Drum star
Add this code to get the upgrade if the player has enough beats, or say Not enough beats! if they
are not able to upgrade:
hide
else
Let other sprites and the Stage know that the snare upgrade has been bought.
https://projects.raspberrypi.org/en/projects/drum-star/print 16/29
02/06/2022, 08:40 Drum star
hide
else
show
When you upgrade your equipment, you will be able to play at bigger venues.
https://projects.raspberrypi.org/en/projects/drum-star/print 17/29
02/06/2022, 08:40 Drum star
Add another backdrop. We chose Chalkboard to play our second gig at school.
Add code to the Stage to switch backdrop when the upgrade message is received:
Tip: Choose a venue that’s a small step up from the bedroom. You want to save bigger venues for later.
Test: Run your project. Try and buy the snare upgrade before you have enough beats.
When you buy the upgrade check: the snare appears, the button disappears, the venue changes and the
beats go down by 10.
https://projects.raspberrypi.org/en/projects/drum-star/print 18/29
02/06/2022, 08:40 Drum star
The Drum Costumes sprite has lots of drum costumes for you to choose from.
Click on the Drum Costumes sprite and select the Costumes tab.
Choose: a drum for the next upgrade. We chose Conga.
Drag the ‘hit’ and ‘not hit’ costumes of your chosen drum to your new Drum-snare2 sprite:
https://projects.raspberrypi.org/en/projects/drum-star/print 19/29
02/06/2022, 08:40 Drum star
Click on the Code tab. Change the code to use the correct costumes and choose a sound for your new
drum.
Change the number of beats you earn by clicking the new drum to 5:
https://projects.raspberrypi.org/en/projects/drum-star/print 20/29
02/06/2022, 08:40 Drum star
Next, you need a button so that players can upgrade to this new drum.
Delete the snare drum from the button costume. Copy and paste the ‘not hit’ costume for your new
drum to the button costume.
Click on the Text tool and change the number to 30 to show the cost of the new drum.
This button should hide at the start, then show when the player upgrades to the snare drum, so they know which
drum they are working towards.
https://projects.raspberrypi.org/en/projects/drum-star/print 21/29
02/06/2022, 08:40 Drum star
when clicked
show
hide
Tip: To delete a block, drag it to the Blocks menu, or right-click and choose Delete Block. On a
computer, you can also click on a block and then tap Delete to remove a block.
Add a when I recieve script that your new drum button will show as the next upgrade when the
player gets the Drum-snare drum:
https://projects.raspberrypi.org/en/projects/drum-star/print 22/29
02/06/2022, 08:40 Drum star
Change the number of beats needed to buy this drum, and the number of beats that are removed, when
the player gets this drum.
Also change the message that is broadcast when the player gets the new drum. Create a new
message with the name of your new drum:
hide
else
Change the when I receive snare script to broadcast the name of your new drum. The drum will
show when the player upgrades to the new drum:
show
https://projects.raspberrypi.org/en/projects/drum-star/print 23/29
02/06/2022, 08:40 Drum star
Test: Click the green flag to start the game and test that you can earn enough beats to get your new
drum.
What happens if you click the button before you have earned enough beats?
https://projects.raspberrypi.org/en/projects/drum-star/print 24/29
02/06/2022, 08:40 Drum star
It’s time to make your game work just the way that you want
it to.
Are you happy with how many beats it costs to get a new drum?
Tip: Test your project regularly so you can find and fix any bugs.
If you separated the ask block on the Stage, put it back and set your rock star name.
https://projects.raspberrypi.org/en/projects/drum-star/print 25/29
02/06/2022, 08:40 Drum star
There are lots more drum costumes to choose from to add more upgrades to your project.
To add another drum to upgrade to, look back at the earlier steps of the project.
For the drum, you will need to:
Change the costume and sound used in the when this sprite clicked script.
Change the number of beats earned in the when this sprite clicked script.
Change the message that makes the drum show to a message for the new drum.
Change the message that makes the button appear to the message broadcast by the previous drum.
Change the number of beats you must have to get this drum in the if condition. Change the negative
number of beats you change by when you get this drum. Change the message that gets broadcast
to the name of the new drum.
https://projects.raspberrypi.org/en/projects/drum-star/print 26/29
02/06/2022, 08:40 Drum star
Add a script to the Stage to switch backdrop to the new backdrop when the message for this drum
is receieved.
You might find that your drums need to be in a new position on a different backdrop.
Add script starting with when backdrop changes to to each drum sprite with a go to block to
make them change position.
You will also need to set their starting position when flag clicked.
Tidy: If you have time, then it’s a good idea to make sure the sprites in the sprite list are in a sensible
order, starting with the drums in their upgrade order and then the buttons in order.
Debug: First make sure you really understand when the drums and buttons should show and how the
beats variable should change. It’s much easier to debug a project if you are clear on what it is supposed
to do.
Check that the Get button for this drum broadcasts the same message.
The number of beats doesn't change correctly when I get a new drum
Check that you have changed beats by a negative number when this sprite clicked in the
script for the Get button for the drum.
Make sure this matches the number on the drum button costume.
Completed project
https://projects.raspberrypi.org/en/projects/drum-star/print 27/29
02/06/2022, 08:40 Drum star
https://projects.raspberrypi.org/en/projects/drum-star/print 28/29
02/06/2022, 08:40 Drum star
What next?
If you are following the More Scratch (https://projects.raspberrypi.org/en/raspberrypi/more-scratch)
pathway, you can move on to the Next customer please! (https://projects.raspberrypi.org/en/projects/next-
customer-please) project, where you will make a shop where customers can buy items and check out.
If you want to have more fun exploring Scratch, then you could try out any of these projects (https://projects.ra
spberrypi.org/en/projects?software%5B%5D=scratch&curriculum%5B%5D=%201).
https://projects.raspberrypi.org/en/projects/drum-star/print 29/29