Memory game using Scratch| Step by step Scratch Tutorial

In this scratch tutorial, you will create a memory game in which you have to memorize
and repeat a random sequence of colors!

Before the tutorial starts, check out the game here

Lets sketch out memory game in scratch

  • Create a colour sequence
  • Repeat the sequence
  • Multiple levels
  • High score
Memory Game on scratch
Memory Game On Scratch

Create a colour sequence

First create a character that can display a random sequence of colours and backdrop.

Give your character four different color costumes each representing different number. For example number 1 for red, 2 for yellow and so on…

Make sure that your coloured costumes are in the same order as the list above.

Next, add a list called ‘sequence’ for storing the random sequence of colours that the player has to remember. Make sure to choose For this sprite only when you create the list.

We already added the different number to each color, so you can choose a random colour by
randomly choosing a number and adding it to the list.

Each time a number gets added to the list, the character should change its costume so the costume’s colour matches the number.

Then, add sound each time the character sprite changes costume.

Repeat the sequence

Now you are going to add four buttons the player has to press to repeat the colour sequence. Same color as your character sprite costume.

program the red button sprite so that, when the sprite is clicked, it broadcasts a ‘red’ message to the character sprite.

When your character sprite receives the message red , the code should check whether the number 1 is at the start of the sequence list. If it is, the code should remove the number from the list, because the player remembered the correct colour. Otherwise game over, and the code needs to stop all to end the game.

Then program the sprite so that a drum beat also plays when the character sprite receives the correct broadcast .

When the player repeats the whole colour sequence correctly, the sequence list empty and the player wins. If you want, you can also display some flashing lights as a reward once the sequence list is empty.

Add Score and Multiple levels

So far, the player only has to remember a sequence of five colours. Improve your game by adding a score to the game.

Based on the score, the game will decide on the length of the colour sequence. Start with a score (and a sequence length) of 3 .

If the player repeats the correct sequence, you should add 1 to score , and doing so increases the length of the next sequence and the game moves to the next level and the colour sequence to remember becomes longer.

Test the code.

2 thoughts on “Memory game using Scratch| Step by step Scratch Tutorial”

  1. Pingback: My Homepage

Leave a Comment