In this lesson we will make a volcano smoke, rumble and then erupt with lava. We will create the sprites for the smoke and lava and use messages to time when everything happens.
Create a new Scratch project and delete the cat sprite.
Go to the Scratch website using the link below and click on the 'Create' link in the blue bar at the top.
By default, each new project starts with the cat sprite already added. To delete the cat click on the x in the blue circle beside the cat in the sprite list.
New Scratch projects have the cat sprite automatically added to them so this step of deleting the cat (if it's not needed) will be frequently performed.
Colour the backdrop blue by following these steps.
Included with this lesson is a volcano picture that we're going to upload into our Scratch project. To first download the picture file onto your computer and then upload it into your project.
The volcano sprite will upload into your project and appear in the stage area. Drag the volcano to the bottom of the stage area.
We will make the volcano smoke when we press the space bar. Add the following code to the volcano sprite:
when [space v] key pressed
broadcast [smoke v]
If you're using a tablet or iPad without a physical keyboard, you won't be able to use keyboard keys like the arrow keys in your project. Instead, we'll add simple on-screen buttons (using sprites) that you can tap to do the same things. This keeps your project working great! Just follow these steps wherever the lesson talks about pressing a key.
First, add a new sprite for your button:
Now, program your button sprite to make things happen when you tap it. Here's how it works for different situations:
Example 1: If the lesson uses a key to trigger an action on a specific sprite (like making something move, turn, or jump)
Instead of code like this on your target sprite:
when [left arrow v] key pressed
change x by (-10) // or any action
Or this:
if < key [left arrow v] pressed? > then
change x by (-10) // or any action
end
Add this code to your new button sprite:
when this sprite clicked
broadcast [do action v]
Then, on your target sprite, add this to receive the message:
when I receive [do action v]
change x by (-10) // or any action
Tap the button on the screen, and the action will happen, just like pressing the key! Use a unique broadcast name for each different action or key.
Example 2: If the lesson uses a key to change a variable (like adding to a score or setting a value)
Instead of code like this:
when [space v] key pressed
change [score v] by (1)
Or this:
if < key [space v] pressed? > then
change [score v] by (1)
end
Add a new button sprite. Then, put this code on the button sprite:
when this sprite clicked
change [score v] by (1)
(If the variable is "for this sprite only," make sure it's set to "for all sprites" so the button can change it.)
Tap the button, and the variable changes, no message needed since it's something shared!
To simulate smoke coming from the volcano we're going to paint a new sprite. Click on the 'Paint new sprite' button (the paint brush highlighted in yellow) and follow these steps:
To make the volcano appears that smoke is coming out of it we will create copies of our newly painted smoke sprite and make them float out of the top of the volcano. This will happen for a random length of time and then we'll send the 'shake' message which will tell the volcano to start shaking.
Add the following code to the smoke sprite:
Set it up
When it receives 'smoke' message
When it starts as a clone
We use the pick random 1 to 10 blocks so the smoke appears for a random length of time, is a random size and comes out in a random direction.