Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. Basic Game Framework: A Matching Game

3. Basic Game Framework: A Matching Game

Source Files

http://flashgameu.com

A3GPU03_MatchingGame.zip


To build our first game, I’ve chosen one of the most popular games you will find on the Web and in interactive and educational software: a matching game.

Matching games are simple memory games played in the physical world using a simple deck of cards with pictures on them. The idea is to place pairs of cards face down in a random arrangement. Then, try to find matches by turning over two cards at a time. When the two cards match, they are removed. If they don’t match, they are turned face down again.

A good player is one who remembers what cards he or she sees when a match is not made, and can determine where pairs are located after several failed tries.

Note

Sometimes educational matching games for children don’t have exact matches in a pair of cards. For instance, one card can have a picture of a cat on it, whereas the other card has the word cat. Or, one card can have the number 7, whereas another has 3+4.


Computer versions of matching games have advantages over physical versions: You don’t need to collect, shuffle, and place the cards to start each game. The computer does that for you. It is also easier and less expensive for the game developer to create different pictures for the cards with virtual cards rather than physical ones.

To create a matching game, we first work on placing the cards on the screen. To do this, we need to shuffle the deck to place the cards in a random order each time the game is played.

Then, we take the player’s input and use that to reveal the pictures on a pair of cards. Then, we compare the cards and remove them if they match.

We also need to turn cards back to their face-down positions when a match is not found. And then we need to check to see when all the pairs have been found so that the game can end.

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint