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

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

Introduction: Card Matching Game in Scratch

Watch the video tutorial here:

Want to build a fun, interactive game in Scratch that challenges memory and improves logic skills? You’re in the right place!

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 coding concepts like variables, lists, cloning, custom blocks, and conditional logic — all in a fun and visual way.

By the end of this Part 1, you’ll have:

  • A grid of face-down cards displayed using clones
  • A randomized set of matching card pairs
  • A solid foundation to build the full game logic (which we’ll finish in Part 2)

Whether you’re a student, teacher, or hobbyist, this tutorial is perfect if you’re looking for an easy Scratch game tutorial that teaches real programming skills through a hands-on project.

Let’s get started building your own card matching game in Scratch!

Card Matching Game in Scratch: Step‑by‑Step Coding

Prerequisites: What you need in Scratch before coding

  1. One blank card costume (rectangle or square) — name sprite “Blank” (or “Card” base)
  2. A set of image sprites or costumes (e.g. Apple, Ball, Banana, Balloon, Beetle, Butterfly, Cake, Cat, etc.)
    • These will become the faces of cards
  3. Backdrops: one for game play, plus “Game Over” and “Victory” backdrops

Variables & Lists needed

  • card counter (global variable) — counts total cards/clones
  • card suits (global variable) — how many different image types (pairs) you will use
  • card list (global list) — holds the identity values for each card (each clone) in randomized order
  • card identity (sprite‑only / clone‑only variable) — for each clone, what image/type it corresponds to

Custom Blocks (My Blocks)

  • Make Cards — responsible for creating the grid of cards (layout + clones)
  • Make List — responsible for building the list of card identities (pairs, randomized)

1. Setup Sprites & Costumes

  • Blank card sprite: Create a blank card (painted rectangle / square), give it a border/outlines as desired. Name this sprite “Blank”.
  • Image sprites: Choose your matching image sprites (apple, ball, banana, balloon, beetle, butterfly, cake, cat, etc.), for each one center the image, align it with the blank card (so when over the blank, they align visually), and make sure each has costumes that correspond: first costume blank, next are the images.
  • Naming convention: Give each image (costume) a number or identifier (e.g. “1”, “2”, …). In Scratch you may assign costumes labels, or a variable “card identity” to each clone.

2. Backdrops: Stage Scenes

  • Choose a plain background (for the game).
  • Create additional backdrops for Victory and Game Over states. For example duplicate the blank stage backdrop, then edit it / add text or images to represent victory or game over.

3. Layout: Grid of Cards via Cloning

You want, say, 30 cards in a grid of 6 columns × 5 rows (or whatever layout fits screen). Clone the blank card sprite to make multiple cards instead of manually placing many sprites.

Logic code blocks (pseudocode / Scratch):

when green flag clicked
    set [card counter v] to (0)
    hide    // the original sprite temporarily
    set size to (50) %   // sets size of cards
    switch costume to [Blank v]
    create custom block [Make Cards v]  // your own block

Inside Make Cards:

define Make Cards
    // initial position to top-left (or desired start) e.g. 
    go to x: (-200) y: (125)
    repeat (number of cards)  // e.g. 30 cards
        change [card counter v] by (1)
        create clone of [myself v]
        change x by (80)         // shift right per card
        if x exceeds some threshold then
            set x to initial X
            change y by (–some vertical spacing)  // go to next row
        end
    end

And for clones:

when I start as a clone
    show
    set size to (50)
    switch costume to [Blank v]
    // position as per clone (handled via the Make Cards logic)

This puts all cards face‐down (i.e. blank) in grid form.

4. Variables & Lists: Managing Card Identities & Randomization

You’ll need:

  • Variable card counter (for all sprites): to count how many cards you have (clones + original).
  • List card list: holds the identity (numbers) of each card in the deck (length equals number of total cards).
  • Variable card suits (or better named card type / card identity): to assign which image goes where.

Logic:

  • At start (green flag), delete all entries in card list so it starts fresh.
  • Create the list: for each card type (e.g. 8 types), insert two of each type into the list (so pairs), then shuffle / insert at random positions so that the card types are scattered.
  • For each clone (card sprite), assign a card identity variable based on the corresponding item in the shuffled list. This identity tells which image (costume) to show when flipped.

Pseudocode in Scratch terms:

when green flag clicked
    delete all of [card list v]
    set [card counter v] to (total cards)  // e.g. 30
    // card suits = number of image types (excluding blank costume), e.g. 8
    set [card suits v] to (8)
    // build the list
    repeat (card suits)
        repeat (2)   // each image twice
            insert (repeat index) at (random (1) to (length of card list) ) of [card list v]
        end
    end
    // optionally continue until length of card list equals card counter
  • Then each clone, when created, picks a position in list, retrieves item, and stores it in its own card identity variable. This ensures the image tied to that clone is fixed for that game.

5. Putting Together: Main Script Structure (Part‑1)

A high‑level script for the original blank card sprite might look like:

// In “Blank” sprite (which is cloned)
when green flag clicked
    set [card counter v] to (0)
    hide
    set size to (50)
    switch costume to [Blank v]
    call [Make Cards v]
    call [Make List v]

Custom blocks:

  • Make Cards: handles layout, cloning, positioning.
  • Make List: handles building card list, setting card suits, randomization.

In clone script:

when I start as a clone
    show
    set size to (50)
    switch costume to [Blank v]  // face down
    // We’ll later add “when this clone clicked” to flip the card

6. Summary of What’s Built So Far

By end of Part 1 (Kodex Academy video and this write‑up) you have:

  • Sprites & costumes ready (blank + image types).
  • Backdrops for play, Game Over, Victory.
  • Layout of cards via clones in grid.
  • List of card identities built and assigned.
  • Variables to keep track of card count, card suits / types.

What remains (for Part 2):

  • Flipping the cards when clicked.
  • Checking for matches.
  • Handling lives / scoring.
  • Game over and victory logic.
  • Adding visual/sound effects.

Sample Scratch Code Blocks

(This covers Part 1; flipping etc. come in Part -2.)

Since I can’t share actual Scratch project here, I’m giving sample pseudo‑blocks you’d implement. You’ll adapt them in the Scratch editor.

// Variables (global)
card counter       // for total clones / cards to display
card suits         // number of different image types
card list          // list of identities, length = card counter

// Sprite: Blank / Card Sprite

when green flag clicked
    set [card counter v] to (30)     // e.g. 30 cards = 2 × 15
    hide
    set size to (50)
    switch costume to [Blank v]
    call [Make Cards v]
    call [Make List v]

define Make Cards
    go to x: (-200) y: (125)
    set [columns v] to (6)  // for grid, e.g., 6 columns
    set [rows v] to (5)     // e.g., 5 rows
    // optional: compute spacing based on size and screen size
    repeat (rows)
        repeat (columns)
            change [card counter v] by (1)
            create clone of [myself v]
            change x by (80)   // adjust
        end
        change y by (−75)      // adjust vertical
        set x to (initial X)   // reset to leftmost column
    end

define Make List
    delete all of [card list v]
    set [card suits v] to (8)
    // for each card type
    repeat (card suits)
        repeat (2)
            insert (repeat index) at (random (1) to (length of [card list v] + 1)) of [card list v]
        end
    end

// Clone behaviour

when I start as a clone
    show
    set size to (50)
    switch costume to [Blank v]
    // Later: when this clone clicked → flip → show appropriate image per card identity

Enhancement Ideas & Features: Code Snippets

Here are sample Scratch‑style pseudocode for a few of the enhancements above.

A) Lives & Score

when green flag clicked
    set [Lives v] to (15)
    set [Score v] to (0)

when this sprite (clone) clicked
    // logic to flip, check for two cards selected
    if (this clone’s card_identity = other selected card_identity) then
        // match
        change [Score v] by (1)
        play sound [win v]
        // leave both flipped up, or remove them
    else
        // mismatch
        change [Lives v] by (−1)
        play sound [fail v]
        // flip them back after a short wait
    end

    if (Lives = 0) then
        switch backdrop to [Game Over v]
        stop [all v]
    end

B) Timer

when green flag clicked
    set [Timer v] to (60) // seconds
    repeat until <Timer = 0> or <all pairs matched>
        wait (1) secs
        change [Timer v] by (−1)
    end
    if <Timer = 0> then
        switch backdrop to [Game Over v]
        stop [all v]
    end

C) Difficulty Selector

// On the stage, have buttons “Easy”, “Medium”, “Hard”
when [Easy button v] clicked
    set [card_suits v] to (4)
    set [card_counter v] to (8)  // 2 × 4
    broadcast [New Game v]

when [Medium button v] clicked
    set [card_suits v] to (8)
    set [card_counter v] to (16)  // 2 × 8
    broadcast [New Game v]

when [Hard button v] clicked
    set [card_suits v] to (12)
    set [card_counter v] to (24)
    broadcast [New Game v]

when I receive [New Game v]
    // rebuild list, layout, etc using the variables above

Other enhancement ideas that can be implemented in the game:

EnhancementPurpose / BenefitSample Implementation
Sound EffectsFeedback for correct/incorrect matches. More game‑feel.Use sound blocks: play sound [pop v] until done on flip; play sound [win] on match; play sound [fail] on mismatch.
Animations / Effects on FlipSmoother transitions. Better UX.Use glide or change size or ghost effects. E.g. when flipping, change size in two steps to simulate flip, or use change color effect.
High Score SavingIncentivizes improvement.Use Scratch cloud variables (if available) to save highest score. On game end, compare current score to cloud high score; update if higher.
Hints / Peek FeatureHelps users if stuck. Improves usability.Add a button or broadcast message that when pressed briefly flips a few random pairs for 2 seconds as hint, then flips back. Use clones, show costumes, wait, then flip back to blank.
Shuffle on ReplayEnsures new layout each time so game remains fresh.On “Play Again” or on when green flag clicked, rebuild card list with random insertion, reassign card identities, and reposition clones.
Responsive Layout / Scalable GridSupports different screen sizes or numbers of cards.Compute grid columns & rows based on card counter or user selection; compute x/y positions accordingly. Variables like card_size, spacing_x, spacing_y.

Common Errors & Troubleshooting Tips

  • Make sure you align images and blank card costumes so when you flip, the image doesn’t look off‑centre.
  • If the number of cards is odd, you’ll end up with a non‑paired card: always make card counter even, card suits × 2 ≤ card counter.
  • Clones: be careful how you assign identity — you need a consistent way to map each clone to one item in the card list.
  • Delay timing: when two cards are flipped and they don’t match, include a small delay (wait) so player sees the second one before it flips back.
  • Avoid running duplicate scripts in clones that conflict; for example, a clone should only react to clicks when it’s face down and fewer than two cards are flipped.

Conclusion: Memory Skill Game in Scratch

Congratulations! 🎉 You’ve just built the entire foundation of a fun and interactive card matching game in Scratch.

In this first part, you learned how to:

  • Set up a blank card and image sprites
  • Use cloning to create a dynamic grid of cards
  • Create and randomize a list of matching pairs
  • Assign unique identities to each card
  • Prepare variables and layout logic to power the full game

This is an excellent beginner project that introduces critical coding concepts in Scratch like variables, lists, loops, cloning, and custom blocks. You now have all the tools needed to take the next step: flipping cards, detecting matches, scoring points, and adding game-over/victory logic — which we’ll cover in Part 2.

What’s Next?

In Part 2 of this Scratch tutorial, we’ll cover:

  • How to flip cards on click
  • How to detect a match or mismatch
  • Add score, lives, and win/loss conditions
  • Add animations and sound effects to make it more engaging
  • End game with Victory or Game Over screens

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 1 – 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