Rock band - Scratch

 

Rock band


Introduction

Learn how to code your own musical instruments!

What you will make

Click the green flag to begin. Then, click on the singer or the drum to hear what they sound like.

What you will need

Hardware

  • A computer capable of running Scratch 3

Software


Sprites

Before you can start coding, you’ll need to add in a ‘thing’ to code. In Scratch, these ‘things’ are called sprites.

Open a new Scratch project.

Online: open a new online Scratch project at rpf.io/scratch-new.

Offline: open a new project in the offline editor.

If you need to download and install the Scratch offline editor, you can find it at rpf.io/scratchoff.

It looks like this:

screenshot

The cat sprite that you can see is the Scratch mascot. You don’t need it for this game, so get rid of it by clicking on the X in the corner.

screenshot

Next, click on Choose sprite from library to open up a list of all the Scratch sprites.

screenshot

Scroll down until you see a drum sprite. Click on a drum to add it to your project.

screenshot

Click and drag the drum to the bottom of the Stage.

Give your program a name by typing into the text box at the top.

name

Then click on File, and then on Save now to save your project.

If you are not online or don’t have a Scratch account, you can save a copy of your project by clicking on Save to your computer instead.

screenshot


The Stage

The Stage is the area on the right, and is where your project comes to life. Think of it as a performance area, just like a real stage!

At the moment, the stage is white and looks pretty boring! Add a backdrop to it by clicking on Choose a backdrop.

screenshot

Click on Indoors in the list at the top. Then click on a theatre backdrop.

screenshot

Your stage should now look similar to this:

screenshot


Making a drum

Now you will add code to your drum so that the drum makes a sound when it’s clicked.

You can find the code blocks in the Scripts tab, and they are all colour-coded!

First add the Music extension so you can play instruments.

Click on the Add extension button in the bottom left-hand corner.

add extension button highlighted

Click on the Music extension to add it.

music extension highlighted

Click on the drum sprite, and then drag these two blocks into the code area on the right:








 

screenshot

Make sure that the blocks are connected together (like LEGO bricks).

Click on the drum to try out your new instrument!


Challenge: improving your drum

Can you change the sound that the drum makes when it’s clicked?

screenshot

Can you also get the drum to make a sound when the space bar is pressed? You’ll need to use this event block:









screenshot