Scratch Game
45 mins
+160 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Memory Game part 2

This is part 2 of the Memory Game project.

Lesson Files

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Complete part 1 of this project

    In a separate lesson you should have completed part 1 of this project. Open your project in Scratch and continue to the next step in this lesson.

    2 - Add the 'Arrow1' sprite

    The player will enter in their answer by moving an arrow and clicking the coloured circles. Add the Arrow1 sprite from the sprite library and then add the following code to the Arrow1 sprite.

    whenclickedswitchcostumetoarrow1-d up arrowforevergotomouse-pointer make it follow the mouse pointer



    3 - Player selects a colour

    Now add the following code to the Arrow1 sprite, to capture when the player clicks one of the colours and save that colour's number into the 'answer' list.

    We will create new messages called 'red', 'blue', 'green' and 'yellow' that we will broadcast. Then in a later step we will receive these messages in the pad sprite and make the correct colour light up and play the sound.

    whenthisspriteclickediftouchingcolor?thenadd1toanswer 1 = redbroadcastred create this messageiftouchingcolor?thenadd2toanswer 2 = bluebroadcastblue create this messageiftouchingcolor?thenadd3toanswer 3 = greenbroadcastgreen create this messageiftouchingcolor?thenadd4toanswer 4 = yellowbroadcastyellow create this message


    4 - Check their answer

    When the player has entered the same amount of colours that's in the 'sequence' list, we will go through each colour and check if the sequence is correct.

    If any of them are incorrect then we will play a sound and use the stop [all] block to end the game.

    Add the following new code blocks to the Arrow1 sprite at the bottom of the When this sprite clicked block of code.

    whenthisspriteclickediftouchingcolor?thenadd1toanswerbroadcastrediftouchingcolor?thenadd2toanswerbroadcastblueiftouchingcolor?thenadd3toanswerbroadcastgreeniftouchingcolor?thenadd4toanswerbroadcastyellowiflengthofanswer=lengthofsequencethensetxto1 start our counter at 1repeatlengthofanswerifnotitemxofanswer=itemxofsequencethenplaysoundToy Honkuntildoneadd this soundstopall game over if they do not matchchangexby1 add 1 to our counter go through each item in the lists add this new code

    5 - Play the next round

    If they got the sequence correct then we will:

    1. change the arrow into a check mark.
    2. play a sound.
    3. change it back to the arrow.
    4. send a message to play the next round.

    First add a new costume (Button4-1) to the Arrow1 sprite and rename the costume to be called 'correct'.

    Then add the following new code to the Arrow1 sprite underneath the repeat block.

    whenthisspriteclickediftouchingcolor?thenadd1toanswerbroadcastrediftouchingcolor?thenadd2toanswerbroadcastblueiftouchingcolor?thenadd3toanswerbroadcastgreeniftouchingcolor?thenadd4toanswerbroadcastyellowiflengthofanswer=lengthofsequencethensetxto1repeatlengthofanswerifnotitemxofanswer=itemxofsequencethenplaysoundToy Honkuntildonestopallchangexby1 go through each item in the listswait0.5seconds add this new codeswitchcostumetocorrect show the check markplaysoundTadauntildone add this soundswitchcostumetoarrow1-d switch back to the up arrowbroadcastnext round send this message to play next round



    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    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