How to make a Card Matching Game in Scratch | Memory Skill Game in Scratch — Part 1 | Step-by-Step Coding
Scratch Game
Introduction: Card Matching Game in Scratch
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!
What You Will Learn:
This comprehensive guide teaches you how to:
- ✅ Set up sprites and costumes for the card game
- ✅ Create a grid layout using cloning
- ✅ Manage card identities with variables and lists
- ✅ Randomize card positions for fair gameplay
- ✅ Build custom blocks for organized code
- ✅ Prepare the foundation for Part 2 (flipping and matching logic)
This project is perfect for beginners and intermediate Scratch users who want to learn Scratch programming through game development.
👉 Watch the Full YouTube Tutorial Here:
How to make a Card Matching Game in Scratch | Memory skill game in Scratch — Part 1 — Kodex Academy
How to make a Card Matching Game in Scratch | Memory skill game in Scratch — Part 2 — Kodex Academy
Project Overview: What You'll Build
In this game:
- The game displays a grid of face-down cards (e.g., 6x5 grid for 30 cards)
- Each card has a matching pair with the same image
- Cards are randomized so matches aren't predictable
- The foundation is set for players to click cards, flip them, and find matches
- In Part 2, we'll add scoring, lives, and win/lose conditions
This is an excellent starter project for learning cloning, lists, randomization, and Scratch game structure.
Prerequisites: What You Need in Scratch Before Coding
- One blank card costume (rectangle or square) — Name the sprite "Blank" (or "Card base")
- 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
- Backdrops: One for game play, plus "Game Over" and "Victory" backdrops
Card Matching Game in Scratch: Step-by-Step Coding
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.), 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 use 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.
go to x: (-200) y: (125)
set [columns v] to (6)
set [rows v] to (5)
repeat (rows)
repeat (columns)
change [card counter v] by (1)
create clone of [myself v]
change x by (80)
end
change y by (-75)
set x to (initial X)
end
And for clones:
show
set size to (50)
switch costume to [Blank v]
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 identity`): to assign which image goes where.
delete all of [card list v]
set [card suits v] to (8)
repeat (card suits)
repeat (2)
insert (repeat index) at (random (1) to (length of [card list v] + 1)) of [card list v]
end
end
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)
when green flag clicked
set [card counter v] to (30)
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:
show
set size to (50)
switch costume to [Blank v]
// Later: when this clone clicked → flip → show appropriate image per card identity
Summary of What's Built So Far
By end of Part 1 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
Enhancement Ideas & Features
Some ideas to expand the game:
- Lives & Score: Add variables for lives and score, decrease lives on mismatch, increase score on match.
- Timer: Add a countdown timer for added challenge.
- Difficulty Selector: Allow players to choose easy (fewer cards), medium, or hard.
- Sound Effects: Play sounds for flips, matches, and mismatches.
- Animations: Add smooth flip animations or effects.
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
Happy coding with Kodex Academy! 🚀