Scratch Exercise 3:
Something to Eat. Conditionals, Variables, Hiding, and Sound.
1: Create the food!
1. Select a New Sprite from file. I used a tennis ball, but you
can select or draw anything.
2. Use the "shrink sprite tool" to make the food smaller in relation to
the rest of the world.
3. Rename the sprite. (I chose "Ball.")
2: Create the scripts for score and hiding.
1. Click on "Variables" and "Make a Variable" and name it
"Score." Click "Ok."
2. Drag a "When Green Flag Clicked" and a "Forever If" into the Ball's
3. Add the following scripts:
a. Set "Score to 0" between the Green Flag and the Forever if.
b. "Change Score by 1" inside the "forever if."
c. Blue Hexagon "touching 'Eater'" inside the forever if.
4. Add a "show" and "hide" to the script. Put the "show"
underneath the "when Green Flag Clicked" and the "hide" inside the
5. Check your program. Click the green flag and run your Eater
over the food. It should hide and change your score by 1.
Click the Green Flag again, the score should set to zero and the food
should show again.
3: Add a Sound when the Eater touches the ball.
1. Make sure you are on the Eater sprite. Click the "Sounds" tab.
2. Select "Import Sound" and select a sound from the folder list.
3. You can test your sound by clicking the blue play triangle under the
4. Click on the Scripts Tab. Drag a purple "play sound and wait" block
into the Ball's script.
5. Click the Green Flag and test your program. When the Eater
touches the Ball you should hear a sound and the score should increase
1. Once you are satisfied with the Ball sprite and its scripts, click
the "Stamp" tool and then click on the sprite you wish to copy.
Use the "Stamp" tool to copy your Ball sprite.
2. Copy and arrange the ball sprites around the maze.
Add background music.
1. You may add background music to your game. Scratch will play
any .mp3 or .wav files.
2. Click on the stage icon.
3. Click on Sounds and import a sound like Step 3.
4. Drag a "When Green Flag Clicked" into the the Scripts pane.
5. Drag a "forever" and a "play sound and wait" block and arrange like
6. Click the green flag and test your game.
Back to Nebo Scratch
Programming Projects Page