Coding Ireland STEM Report 2024 Have Your Say
Scratch Game
Expert
45 mins
225 points
What you need:
  • Computer/laptop

Memory Game part 1

Can you remember the correct sequence and repeat it? How many levels can you get correct?! This is a large project so it's broken into 2 parts.

1 - Introduction

In this project we are going to try and recreate the classic Simon Says game where you need to remember and repeat the colours in the right order.


2 - Create a new Scratch project

Create a new Scratch project and delete the cat sprite.

3 - Draw the pad sprite

We need a pad sprite that has a large black circle with 4 smaller circles inside it. This sprite should have 5 costumes:

  1. a 'blank' costume with none of the lights on.
  2. a 'red' costume with the red light on.
  3. a 'blue' costume with the blue light on.
  4. a 'green' costume with the green light on.
  5. a 'yellow' costume with the yellow light on.

To create the pad sprite you have two options:

1.) Upload the sprite
Download the sprite included with this step called 'scmemg pad.sprite3' and then upload it into your project. This has the 5 costumes already setup.

2.) Create you own sprite
Create a new sprite and draw a large black circle with 4 smaller circles inside it. The 4 smaller circles should be red, blue, green and yellow.

In the 'blank' costume make sure the small colour circles aren't too bright, so they look like they're off. Then duplicate the blank costume 4 times. Edit these copies of the blank costume and rename them 'red', 'blue', 'green' and yellow and make the colour of each of their circles brighter so that each one has one colour turned on (for example the 'red' costume should just have the red light turned on).

4 - Create some variables and lists

We will need 3 variables and 2 lists in our project.

Create the following variables.

  1. level - this will store the level of the round the player is playing.
  2. colour - this will store a random number between 1 and 4 (1 = red, 2 = blue, 3 = green, 4 = yellow).
  3. x - this is a counter variable, we will use it to go through the items in the lists.

Create the following lists.

  1. sequence - this list will store the sequence of the colours in the round. For example in level 3 the sequence might be red, green, red. So we would have 3 items in our 'sequence' list (1, 3, 1 for red, green, red).
  2. answer - this list will store the players answer. As they click their chosen colours it will add their selection to the answer list. For example if the player clicked blue, red, yellow, this would store 2, 1, 4 as the items in the 'answer' list.

You can leave all the variables and lists to display in the stage area for the moment, this will help you see how the code is working.

5 - Create some custom blocks

Create the following custom blocks.

  1. red - this will have the code to display the red circle and play the musical note A.
  2. blue - this will have the code to display the blue circle and play the musical note G.
  3. green - this will have the code to display the green circle and play the musical note C.
  4. yellow - this will have the code to display the yellow circle and play the musical note D.
  5. play round - this will have the code to play a round. It will have a number input called 'number' that will allow us to pass in what round we want to play (we will pass the 'level' variable into it).





Join our club 😃

To view the remaining 5 steps and access hundreds of other coding projects please login or create an account.

Copyright Notice
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.

Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more