How to make Memory Skill Game in Scratch | Card Matching Game in Scratch – Part 2 | Step-by-Step Coding

How to make a Card Matching Game in Scratch Memory skill game in Scratch - Part 2 - Kodex Academy

Introduction: Memory Skill Game in Scratch

Watch the video tutorial here:

In this tutorial you’ll learn how to make memory skill game in Scratch / card matching game in Scratch. This is a great beginner‑to‑intermediate project for scratch tutorial game, scratch programming games, and scratch game tutorials easy. You’ll see how to use variables, costumes, lists, custom blocks, broadcasts, and graphical effects.

Whether you’re teaching children, learning by yourself, or needing a project for Scratch club/class—this is a great game idea: create memory game in scratch / create matching game in scratch, building memory skill game in Scratch.

Why This Game Teaches Useful Skills

  • Logical thinking: deciding what happens when two cards match / don’t match.
  • Use of variables: user control, matchOne, matchTwo, score, lives etc.
  • Use of lists: to store card identities / images / suits.
  • Use of custom blocks: for modularity (“make a list”, “my card”).
  • Scratch programming animation: graphical effects (color, brightness) to give feedback.

Memory Skill Game in Scratch: Step-by-Step Coding

Overview of the Card Matching Game in Scratch

Here’s what your game will do:

  • On “green flag clicked”, initialize variables: user control, matchOne, matchTwo, score, lives.
  • Display a grid of cards (sprites), all showing a “blank” face.
  • When user clicks a card (if control allows), flip it to show its hidden image / identity.
  • The user can flip two cards. After two are flipped, check:
      • If they match → correct: increment score, remove those cards.
      • If not match → incorrect: flip them back, decrement lives.
  • If score reaches a threshold → victory screen.
  • If lives reach zero → game over screen.

This matches very closely what the video shows.

Setting Up Your Scratch Project

If you have followed the Part -1 of this tutorial, you might already designed and setup your project. But, if you are missing anything:

Here are the initial steps, as per the video plus improvements:

  • Create sprites for all the cards. Usually you’ll design one card sprite with multiple costumes (costume for each identity, plus a blank/hidden one).
  • Backdrops: you’ll need at least three backdrops: the game board, victory, game over.
  • Variables:
      • userControl (or “user control”) — yes / no value, to prevent too many clicks
      • matchOne — to store the identity (costume number) of the first flipped card
      • matchTwo — similarly for second card
      • score
      • lives
  • Lists: To store card identities / suits / the mapping of sprite → image.
  • Custom Blocks: e.g. “make a list”, “my card” (from video) to help organizing repeated code.

Core Mechanics: Variables & their Roles

VariableDescription
userControlKeeps track whether user is allowed to click a sprite (e.g. “yes” or “no”). Prevents buggy double clicks.
matchOneStores the costume number of the first card clicked.
matchTwoStores the costume number of second card clicked.
scoreNumber of matched pairs made so far.
livesNumber of attempts left.

Lists

  • Card list: a list of the hidden identities—so you can map each card sprite to an image / identity.
  • Could also maintain a list of which cards have already been removed or matched.

Custom Blocks

  • make a list: populates the card identity list (e.g. with duplicates, shuffle if needed).
  • my card: logic per individual card, e.g. what happens when clicked (flip, show image, check match).

Coding the Card Flip & Match Logic

Here are the essential steps, with sample block or pseudocode style.

when green flag clicked
set [userControl v] to [yes]
set [matchOne v] to [0]
set [matchTwo v] to [0]
set [score v] to [0]
set [lives v] to [20]
delete all of [cardList v]     // clear the list before use
// optionally call a custom block to populate the cardList
call [makeCardList v]

Explanation:

  • userControl is a variable controlling whether the player can click cards.
  • matchOne and matchTwo store the first and second flipped cards (costume numbers).
  • score and lives track progress and remaining attempts.
  • cardList is a Scratch list variable holding the identities of the cards; you delete all items to start fresh each game.
  • makeCardList is a custom block you define that fills and shuffles the card identities.

Sprite (card) behavior: when this sprite clicked

when this sprite clicked
set userControl to "no"
if <userControl = "yes"> then
    // Show graphic effect
    repeat 10
        change color effect by 25
    end
    set brightness effect to 10
    // Switch costume to reveal hidden identity
    switch costume to (item (this sprite’s index) of cardList) // or via costume number
    clear graphic effects
end

Managing which card is first or second clicked

if <matchOne = 0> then
    set matchOne to (costume number)
    wait 0.2 seconds
    set userControl to "yes"
else
    set matchTwo to (costume number)
    // Now check match
    if <matchOne = matchTwo> then
        broadcast [correct]
    else
        broadcast [incorrect]
    end
end

Handling Correct / Incorrect Matches

If Correct

  • Increase score by 1
  • Broadcast “correct”
  • On receiving “correct”:
      * Wait 1 second (so user sees the revealed cards)
      * Delete the matching clones/sprites or hide them so they are no longer clickable
      * Set userControl to “yes” so player can continue

If Incorrect

  • Decrease lives by 1
  • Broadcast “incorrect”
  • On receiving “incorrect”:
      * Wait for a short delay (e.g. 0.5 seconds) so user sees cards before flipping back
      * Apply graphic effect (color / brightness) to flip back nicely
      * Switch costume back to “blank” (hidden)
      * Clear graphic effects
      * Set userControl back to “yes”

End‑Game: Victory, Game Over

  • Check after each match or after each click (particularly after two cards flipped) whether score reaches the target (for example, total number of pairs) → if yes, change backdrop to “Victory” and hide sprites
  • Similarly, if lives = 0, change backdrop to “Game Over” and hide sprites

You wrap these checks inside conditionals triggered after the match logic.

Scenarios & Edge Cases in a Scratch Card Matching Game

1. Game Initialization

  • Scenario: When the green flag is clicked to start or restart the game.
  • Edge Case: The card list isn’t cleared, causing duplicate cards or leftover data.
  • Solution: Always clear the card list and reset all variables before starting.
  • Code snippet:
when green flag clicked
delete all of [cardList v]
set [score v] to [0]
set [lives v] to [20]
set [userControl v] to [yes]
set [matchOne v] to [0]
set [matchTwo v] to [0]
call [makeCardList v]  // populate and shuffle cards

2. User Control Management

  • Scenario: Prevent users from clicking more than two cards at once.
  • Edge Case: User clicks quickly and flips more than two cards.
  • Solution: Use the userControl variable to disable clicks while cards are being checked.
  • How to:
    Before flipping a card:
if <(userControl) = [yes]> then
  set [userControl v] to [no]
  // flip card logic
end

3. Handling Matching Cards

  • Scenario: Two flipped cards are identical.
  • Edge Case: Score isn’t updated or matched cards are not removed.
  • Solution:
    • Broadcast a “correct” message to trigger score update and remove matched cards.
    • Delete matched card clones to remove from the stage.
  • Code snippet:
if <(matchOne) = (matchTwo)> then
  broadcast [correct v]
  wait (1) seconds
  change [score v] by (1)
  delete this clone
else
  broadcast [incorrect v]
end

4. Handling Non-Matching Cards

  • Scenario: Two flipped cards don’t match.
  • Edge Case: Cards stay flipped or user can’t retry.
  • Solution:
    • Broadcast an “incorrect” message to flip cards back after a short delay.
    • Decrease lives by 1.
    • Restore userControl to allow retry.
  • Code snippet:
when I receive [incorrect v]
wait (0.5) seconds
switch costume to [back side] // flip card back
clear graphic effects
set [userControl v] to [yes]
change [lives v] by (-1)

5. Clicking on the Same Card Twice

  • Scenario: User accidentally clicks the same card twice.
  • Edge Case: The game registers two clicks as different cards causing false match or errors.
  • Solution:
    • Add a check to ignore clicks on the same card if it’s already flipped.
    • You can compare card identities or maintain a “clicked” state.
  • Example:
    Before flipping a card, check if it’s already flipped:
if <not <(this card flipped?)>> then
  // proceed with flip
end

6. Game Over Scenario

  • Scenario: Lives reach zero or player completes all matches.
  • Edge Case: The game does not end properly or sprites stay active.
  • Solution:
    • Check lives and score after each match attempt.
    • Change backdrop to “Game Over” or “Victory” accordingly.
    • Hide all sprites or disable further interaction.
  • Code snippet:
if <(lives) = [0]> then
  switch backdrop to [Game Over v]
  hide all sprites
  set [userControl v] to [no]
end
if <(score) = [total pairs]> then
  switch backdrop to [Victory v]
  hide all sprites
  set [userControl v] to [no]
end

7. Card List Integrity

  • Scenario: Card list items might get duplicated or corrupted.
  • Edge Case: Cards display wrong images or game logic breaks.
  • Solution:
    • Clear the card list on every game start.
    • Shuffle cards before assigning.
    • Use consistent costume numbers matching list indices.

8. Graphics and Animation Effects

  • Scenario: Graphical effects glitch or accumulate indefinitely.
  • Edge Case: Cards disappear or effects overlap badly.
  • Solution:
    • Clear graphic effects after every flip or reset.
    • Use repeat loops with small increments for smooth effects.
  • Code snippet:
repeat (10)
  change [color effect v] by (25)
  wait (0.05) seconds
end
clear graphic effects

9. Multiple Instances / Clones Handling

  • Scenario: Game uses clones for cards.
  • Edge Case: Clones are not properly deleted or updated.
  • Solution:
    • Delete clones on correct matches.
    • Reset variables when clones are created.
    • Handle broadcasts to control all clones.

10. User Experience Enhancements

  • Scenario: Game feels slow or too fast.
  • Edge Case: Players get frustrated or bored.
  • Solution:
    • Add a timer or countdown.
    • Add sound effects on match / mismatch.
    • Allow adjustable difficulty by changing lives or number of pairs.

Additional Feature Suggestions & Code

Add Sound Effects on Match/Mismatch

when I receive [correct v]
play sound [correct chime v]

when I receive [incorrect v]
play sound [wrong buzzer v]

Add Timer to Limit Gameplay

  • Create a variable timer
  • On green flag clicked, set timer to a starting value (e.g., 60 seconds)
  • Use a forever loop to decrement the timer every second
  • End game when timer reaches zero
when green flag clicked
set [timer v] to [60]
forever
  wait (1) seconds
  change [timer v] by (-1)
  if <(timer) = [0]> then
    broadcast [gameOver v]
    stop [all v]
  end
end

Shuffle Card List (Custom Block)

define makeCardList
delete all of [cardList v]
// add pairs of cards (e.g., 1 to 6 twice)
repeat (6)
  add (repeatIndex) to [cardList v]
  add (repeatIndex) to [cardList v]
end
// shuffle the list randomly
repeat (length of cardList)
  set [index1 v] to (pick random 1 to (length of cardList))
  set [index2 v] to (pick random 1 to (length of cardList))
  set [temp v] to (item (index1) of [cardList v])
  replace item (index1) of [cardList v] with (item (index2) of [cardList v])
  replace item (index2) of [cardList v] with (temp)
end

Conclusion: Memory Skill Game in Scratch

Creating a card matching game in Scratch is more than just a fun project — it’s a powerful way to boost logical thinking, enhance problem-solving skills, and get hands-on with real programming concepts like variables, conditionals, broadcast messaging, and clone management.

In this step-by-step tutorial, we’ve covered everything from:

  • Setting up the game environment and logic
  • Managing user interaction with variables like userControl, matchOne, and matchTwo
  • Using broadcasts to handle matching/mismatching events
  • Adding engaging visual and sound effects
  • Handling edge cases like rapid clicks or mismatched logic
  • Ending the game gracefully with a win or lose screen

By following along, you’ve learned how to create a Scratch memory skill game that is fun, challenging, and totally customizable. Whether you’re a beginner or teaching kids how to code, this project is a perfect introduction to Scratch programming and game development.

Call to Action

  1. Don’t forget to check out the full video tutorial: How to make a Card Matching Game in Scratch | Memory skill game in Scratch – Part 2 – Kodex Academy
  2. Like, comment & share the video
  3. Visit kodexacademy.com
  4. subscribe to the Kodex Academy YouTube channel for deeper Scratch content.

Happy coding with Kodex Academy! 🚀

Learn More with Kodex Academy

At Kodex Academy, we’re passionate about helping students learn coding in creative ways. This project teaches more than Scratch—it empowers young minds to build tools that work in the real world.

Explore more:

Stay updated with new content, free tutorials, and coding challenges!

Further Reading & Links

Recent Posts

How to Make a Math Racing Game in Scratch | Game Concepts and Complete Tutorial

In this tutorial, you’ll learn to build a Math Racing Game in Scratch. Players solve math problems to move their character forward; wrong answers benefit the opponent. It’s a race of speed, accuracy...

How to make Memory Skill Game in Scratch | Card Matching Game in Scratch – Part 2 | Step-by-Step Coding

In this tutorial you'll learn how to make memory skill game in Scratch / card matching game in Scratch. This is a great beginner‑to‑intermediate project for scratch tutorial game, scratch programming...

How to make a Card Matching Game in Scratch | Memory Skill Game in Scratch – Part 1 | Step-by-Step Coding

In this Scratch tutorial, we'll walk you through how to make a card matching game in Scratch, also known as a memory game or skill game. This is a popular beginner project that introduces essential...

Create a Quiz Game in Scratch | Spelling Test in Scratch | Picture Identification in Scratch

Want to make learning spelling fun, visual, and interactive? In this Scratch tutorial, you'll learn how to make a spelling quiz game in Scratch using picture identification, text-to-speech, and...

How to make a Double Jump Game in Scratch | Platformer game in Scratch | Step by Step Coding

How to make a Double Jump Game in Scratch. Scratch is a fantastic platform for beginners to learn programming by making games, animations, and interactive stories. Among the many kinds of games...

How to Use Variables in Scratch | Variable Blocks in Scratch | Complete Tutorial

Introduction: Variable Blocks in Scratch Whether you’re just getting started with Scratch programming or looking to take your projects to the next level, understanding variables and lists is...

How to Make Earth Revolve Around the Sun in Scratch: A Complete Tutorial & Enhancements

Animating Earth revolving around the Sun is a classic beginner/intermediate Scratch animation project. It combines trigonometry (sine & cosine), variables, loops, and visual scripting. Kids can learn...

How to Make a Game in Scratch | Snake Game in Scratch | Step-by-Step Game Coding

In this tutorial, we’ll build a Snake Grid style game in Scratch step by step (very similar to the Kodex Academy example). By doing this, you’ll cover many of the core Scratch building blocks. We will...

How to Use Operator Blocks in Scratch | Full Guide with Live Coding & Examples

One of the most powerful features in Scratch is its Operator Blocks — essential for handling math operations, logic comparisons, and string manipulations...

How to Create a Thirsty Crow Story in Scratch | Animation Story in Scratch for Kids

In this tutorial, you’ll learn how to create the classic “Thirsty Crow” story in Scratch, using simple animation, voice, and sprite actions. This is a perfect project for kids who are new to coding...

How to Create a Dodge Ball Game in Scratch: A Complete Step-by-Step Tutorial for Beginners

This step-by-step tutorial will guide you through how to create a Dodge Ball game in Scratch from scratch! In this game, you’ll control a character trying to dodge falling balls, earn points, and...

How to use Sensing Blocks in Scratch | Scratch programming for beginners | Live Coding with Examples

In today’s session, we’re diving deep into one of the most powerful features of Scratch — Sensing Blocks. These blocks allow your projects to interact with the world, detect touches, respond to...

Build an Egg Shooting Game in Scratch: Step-by-Step Coding | Complete Guide for Beginners

Learn how to create a fun, interactive shooting game in Scratch with this detailed tutorial inspired by classic arcade games. Perfect for kids and beginners looking to dive into Scratch programming!...

How to Make a Maze Game in Scratch | Step by Step Coding | Full Tutorial & Enhancements

Introduction: Why Build a Maze Game in Scratch? If you’re looking for a Scratch beginner project idea that’s fun, interactive, and educational, then building a maze game in Scratch is the...

Scratch Control Block Tutorial: Full Guide with Loops, Conditions, Cloning & Code Examples

“Control blocks” in Scratch are those blocks (from the Control category) that manage the flow of your script: when things happen, how many times they happen, making decisions, repeating actions...

How to Create a Car Racing Game in Scratch – Part 2 – Step-by-Step Coding

Welcome to your ultimate guide on how to make a car racing game in Scratch—a step‑by‑step tutorial. You'll learn Scratch game development techniques, see actual code blocks, and discover enhancements...

How to Make a Hurdle Jumping Game in Scratch – Build a Fun Hurdle Runner with Score & Win Screen

Are you ready to create your very own hurdle jumping game in Scratch—just like the iconic Chrome Dino or Super Mario? 🎮 Whether you're new to Scratch or just looking for your next fun project, this...

How to Create a Car Racing Game in Scratch – Part 1 – Step-by-Step Coding

In this Scratch car racing game tutorial, we’ll walk you through how to create a fully functional, visually exciting, and incredibly fun car racing game using Scratch. In this blog, we’ll cover: How...
Scroll to Top