In this step, you will set the stage for your first gig and choose a rock star name.
Open the Drum star starter project. Scratch will open in another browser tab
The game starts in a bedroom like a DIY artist.
Click Choose a Backdrop and search for bedroom
.
Choose: Select a bedroom and add it to your project. We chose
.bedroom 3
In Scratch, you can add code to the Stage.
Click on your bedroom backdrop from the Stage pane and add this code:
Every musician needs to choose a rock star name.
A variable is a way of storing numbers and/or text. Your rockstar name will be stored in a variable
so it can be used at any time.
From the
blocks menu, click the Make a Variable button.variables
Call your new variable name
:
Notice: The new name
variable appears on the Stage and can now be used in the Variable
blocks.
At the start of the project, your rockstar name is unknown.
Add a block to set name to
???
:
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:
Set the name
variable
to the answer
:
Change the way your variable
looks on the Stage.
Right-click on the
on the Stage and choose large readout:variable
Drag your
to position it in top-right of the Stage:variable
Test: Run your project to make sure the
starts as variable
???
then updates to your answer
.
Now that you have tested that the
changes to the variable
, 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:answer