Draw a Chart
Let’s draw a chart to help the user understand the quantities of water more easily than if you just told them all the numbers.
Make two new sprites called Tap
and Toilet
. Select this costume for both:
Rename a sprite in Scratch
To rename a sprite in Scratch, click on the sprite:
The information about the sprite will be displayed above:
Edit the name of the sprite.
Draw on the costumes to add descriptive text to them. The Tap
will be labelled with “Tap running for 1 minute” and the Toilet
with “Flushing the toilet”. To add text to your costume you can click on the T icon:
Place the two sprites one above the other on the left hand side of the stage:
Add another costume to your cat sprite, choosing the glass of water from the library.
Then add the following blocks to the end of your code:
Click the green flag to test your program.
Do I have to wait for the old code to run all the time?
If, like me, you don’t want to go through the whole program every time you want to test a new bit of code, then you can move the parts you don’t need out of the way for the moment!
- Detach all the code from the previous card from the green flag block and drag it off to one side — but don’t get rid of it entirely! Just leave it in a space on the current sprite panel.
- Then attach your new code directly onto the green flag.
- When you’re ready, you can put everything back together again.
Note: you should be careful when doing this, as sometimes there might be blocks that you need to run in the code you’re moving aside — you’ll need to keep them in your script to avoid problems!
To use the Pen blocks in Scratch, you need add the Pen extension.
- Click on the Add extension button in the bottom left-hand corner.
- Click on the Pen extension to add it.
- The Pen section then appears at the bottom of the blocks menu.
Add the following blocks to the end of your script. You’ll find the stamp
block in the Pen category.
Click the green flag to watch your new animation!
Note: You might need to change the move 45 steps
to another number depending on the size of your Tap
sprite. The purpose of this block is to place the glass beside the text so you can see it.
How does it work?
The stamp
block makes a sprite stamp an image of itself onto the stage.
It draws the image straight onto the background, so no new sprites are created.
You can double-click the clear
block to remove everything that was added with Pen blocks.
When you run your code again, you’ll see that the stamped glasses are still there at the start. To clear them away, add the clear
block to the top of your script, right after the green flag. You can reset the position of the sprite to the centre as well using a go to
block.
Add similar code to make the sprite illustrate the amount of water that’s used by flushing the toilet (remember, one flush uses 6 litres).