Open a new Scratch project.
Online: open a new online Scratch project at scratch-new.
Choose a character sprite and a backdrop. You could use the ballerina, but your character doesn’t have to be a person, they only need to be able to show different colours.
Give your character four costumes that have different colours, one costumes for each of the four colours shown above. Make sure that your coloured costumes are in the same order as the list above.
If you want, you can use the color a shape tool to fill parts of the costume with a different colour.
Next, add a list for storing the random sequence of colours that the player has to remember.
Create a list called sequence
. Only the character sprite needs to see this list, so you can select For this sprite only when you create the list.
You should now see lots of new code blocks for using lists. The empty list should be visible in the top left-hand corner of the Stage.
Each colour has a different number, so you can choose a random colour by randomly choosing a number and adding it to the list.
Add this code to the character sprite to choose a random number and add it to
:sequence
Test your code. Check that, each time you click the flag, a random number between 1 and 4 gets added to the list.
Can you add code to your program to generate five random numbers at once?
Each time a number gets added to the list, the character should change its costume so the costume’s colour matches the number. Put these blocks into your code immediately below where a random number is added to
:sequence