In this lesson we create a shopping list and choose which items to add to it. Then when we're finished what's on the shopping list gets read back out.
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.
Create a new list called 'shopping list', this will store the items on our shopping list.
When you create your first list you will notice that new blocks for lists become available to use in the Data palette.
At the start, when you click the green flag, we want the shopping list to be empty and also to be hidden (as we're going to get a character to read out what's on the list). Add the following code:
The delete all of [shopping] block deletes all of the items that are in the shopping list. We do this at the start as there may be some items in the list from the previous game.
In the Variables palette, create a new variable by clicking the 'Make a List' button.
Once you click this button a box will appear asking what you want to call your list. Give it a name that reminds you what you will be using it for. For example, if you wanted to keep track of top scores in a game, you would create a list called 'top scores'.
The delete all of [shopping] block deletes all of the items that are in the shopping list. We do this at the start as there may be some items in the list from the previous game.
Add the Room 1 backdrop from the backdrop library.
To add a backdrop from the backdrop library follow these steps:
You can use search box or the filter links (Fantasy, Music, Sports etc) to locate your backdrop.
Add some sprites from the sprite library that you would normally find in a shop such as a banana, an orange, a water melon etc.
Drag each sprite to the sides of the stage area.
To add a sprite from the sprite library follow these steps:
You can use search box or the filter links (Animals, People, Fantasy etc) to locate your sprite.
We're going to use a person sprite to call out the items that have been added to the shopping list. Open the sprite library and scroll down and find a person sprite. Select the sprite by clicking on it and then click 'OK' to add it to your project.
Drag the sprite to the middle of the stage area.