So far, the player only has to remember a sequence of five colours. Improve your game by adding a score, and adding code so that as the player scores points, the game moves to the next level and the colour sequence to remember becomes longer.
Create a new variable called score
.
Based on the
, the game will decide on the length of the colour sequence. Start with a score (and a sequence length) of score
3
.
Add a block at the start of your character’s when flag clicked
code to set the
to score
.3
Instead of always creating a sequence of five colours, you now want the
to determine the sequence length.score
Change the character’s repeat
loop (for creating the colour sequence) to repeat
times:score
If the player repeats the correct sequence, you should add 1
to
, and doing so increases the length of the next sequence. Add the following block to the character’s code at the point you know the sequence is correct:score
Finally, add a forever
loop around the code that generates the sequence, so that the game creates a new colour sequence for each level. This is how your character’s code might look:
Get your friends to test out your game. Remember to hide the sequence
list before they play it!