Memory Matching Game Blueprint for hyperPad on iPad
A memory matching game is a useful first project because the rules are familiar: reveal two cards, keep a matching pair visible, and hide a mismatched pair. Building that loop introduces touch input, stored values, conditions, game state, and a win check.
This documentation-based blueprint plans a six-card matching game with current hyperPad Behaviors. It has not been completed as a live-tested Starter project. Use it to understand the structure, then verify each chain in your current app before relying on it for a class or published game. The first version uses letters instead of custom art so you can focus on how the game works.
What you will build
The board contains three pairs: A, B, and C. Every card starts by showing a question mark.
When you touch a card:
- the card reveals its letter
- the game remembers the first selection
- the second selection is compared with the first
- matching cards stay visible
- different cards return to question marks after a short delay
- finding all three pairs ends the game
Keep this first version in one Scene.
1. Create the Project and board
Create a new hyperPad Project and choose Bird's Eye View. According to the Creating a New Project guide, Bird's Eye View disables gravity by default and is suitable for UI-based and puzzle projects.
Add six Label Objects to the Scene UI layer. Arrange them in two rows and name them Card1 through Card6. Set each label's visible text to ?.
Add two more labels:
- StatusLabel displays instructions and results.
- ReplayButton displays
Play again.
Add one Object outside the visible play area and name it GameController. This Object will store values shared by the whole game.
2. Store each card's identity and state
Attributes store values on an Object. Add these predefined Attributes to every card:
pairID: the card's hidden letterstate: whether the card is hidden, currently revealed, or already matched
Assign the letters in pairs:
| Card | pairID |
|---|---|
| Card1 | A |
| Card2 | B |
| Card3 | C |
| Card4 | B |
| Card5 | C |
| Card6 | A |
Use these state values:
| State | Meaning |
|---|---|
| 0 | hidden and available |
| 1 | revealed during the current turn |
| 2 | matched and no longer available |
The Object Attributes guide explains how to define stored values. Get Attribute retrieves a value from a selected Object, while Set Attribute changes it.
3. Add the shared game state
Add these predefined Attributes to GameController:
| Attribute | Initial value | Purpose |
|---|---|---|
| `firstPair` | empty | stores the first selected letter |
| `selectedCount` | 0 | records whether one card is waiting |
| `locked` | 0 | blocks another selection while a turn resolves |
| `pairsFound` | 0 | counts completed pairs |
Use locked = 0 when input is available and locked = 1 while the second selection is being checked.
Keeping shared state on one controller Object makes it easier to inspect the game's logic. Card-specific values remain on each card.
4. Make a card reveal its letter
Open Card1's Behavior Editor. Start the chain with Started Touching. The documentation states that this Behavior triggers once when the selected Object is touched.
Use Get Attribute and If to check two conditions:
- GameController's
lockedvalue equals 0 - Card1's
statevalue equals 0
The If Behavior runs its connected actions when a condition is met. If both checks pass:
- set GameController's
lockedAttribute to 1 - set Card1's
stateto 1 - get Card1's
pairID - use Set Label to display that value on Card1
- broadcast a message named
CardSelected, passing thepairIDas its value
Execution connections control when Behaviors run. Value connections pass data into Behavior properties. The Sharing Values Between Behaviors guide explains this distinction.
5. Remember the first selection
On GameController, add Receive Message and set its Event Key to CardSelected. Receive Message listens for the matching broadcast and provides its Broadcast Value as an output.
Read selectedCount.
If selectedCount = 0, this is the first card:
- store the received letter in
firstPair - set
selectedCountto 1 - change StatusLabel to
Choose another card. - set
lockedback to 0
The first card remains visible while the player chooses a second card.
6. Compare the second selection
Create an Else If branch for selectedCount = 1. The If documentation explains that you create an Else If by snapping another If to the right of the first.
In this branch:
- get GameController's
firstPair - compare it with the Broadcast Value received from the second card
- send the result into separate match and mismatch branches
Input remains locked until one of those branches finishes.
7. Keep a matching pair
When the two letters are equal:
- broadcast
KeepPair - add 1 to
pairsFound - save the new total
- clear
firstPair - set
selectedCountto 0
Each card listens for KeepPair. A card changes its state from 1 to 2 only when it is currently revealed. Hidden cards and previously matched cards do not change.
After updating the count, check pairsFound:
- If it equals 3, change StatusLabel to
You found all three pairs!and leave input locked. - If it is below 3, change StatusLabel to
A match! Choose another card.and setlockedto 0.
8. Hide a mismatched pair
When the letters are different, change StatusLabel to Not a match. Remember those letters.
Add Wait and choose a short delay such as 0.8 seconds. Wait triggers its next connected event only after the specified time.
After Wait finishes:
- broadcast
HidePair - clear
firstPair - set
selectedCountto 0 - change StatusLabel to
Choose a card. - set
lockedto 0
Each card listens for HidePair. If its state equals 1, Set Label changes its text back to ? and Set Attribute returns its state to 0.
9. Apply the card logic to all six cards
Add the same touch, KeepPair, and HidePair logic to Card2 through Card6.
After copying Behaviors, inspect every Object selection. The touch event, pairID, state, and Set Label action must point to the card you are editing. The shared locked, selectedCount, firstPair, and pairsFound Attributes must still point to GameController.
This check prevents a copied card from revealing or changing Card1 by mistake.
10. Add a restart button
On ReplayButton, connect Started Touching to Restart Scene.
Restart Scene restarts the current Scene. Its Refresh option resets UI Objects and mirrored Objects to their starting state. Keep Refresh enabled so the labels and initial board state are restored.
Required validation before you call the project complete
Build the project in the current version of hyperPad, then press Play and verify:
- the first card reveals one letter
- touching the same revealed card does not count twice
- a matching pair stays visible
- a mismatched pair hides after the delay
- input remains locked while a mismatch is visible
- only a matching branch increases
pairsFound - the win message appears after three pairs
- Play again restores the starting board
If a value appears in the wrong card, inspect the Object selected in Get Attribute, Set Attribute, and Set Label. If a comparison never passes, confirm that the value output is connected to the If input rather than only connecting the execution line.
Make the game your own
Once the letter version works, replace the letters with vocabulary pairs, math questions and answers, or original illustrations. Keep each pair's shared pairID and the same state logic.
You can also add a timer or move counter after the matching loop is reliable. Add one feature at a time and test the full board again after each change.
Try hyperPad Starter and build your first six-card matching game on iPad.

