Graphics Reference
In-Depth Information
13
THE MEMORY GAME
CHAPTER OUTLINE
The DeckArray Class
241
DeckArray Code 242
DeckArray Breakdown 243
The MemoryGameEvent Class
244
MemoryGameEvent Code 244
MemoryGameEvent Breakdown 244
The MemoryGame Class (the Game Engine)
245
MemoryGame Code 245
MemoryGame Breakdown 249
Sample Use of MemoryGame
252
Conclusion
255
The memory game in this chapter was originally built for a site that
was targeted at children. The site itself emulated a board game that
had checkpoints along the way, and there was a spinner for the
users to click to determine how many spaces their game piece
would move. As they passed over each checkpoint, they would
be taken into one of six different secondary games. The memory
game was one of the six. Since then, this same engine has been
used to create a small memory game
that Web site owners
could put on their sites, as well as a slightly modified version for an
iPhone memory game application (Fig. 13.1).
I
widget
ve divided this chapter into four sections, and each one is
needed to build the game. The first three sections are the classes
that make up the core of the game, and the fourth section describes
how a .fla file would be set up to utilize the engine. Don
'
'
t forget, as
I
ve mentioned before, all these files are available to download at
http://www.flashadbook.com/code/.
'
The DeckArray Class
The DeckArray class is used to hold the deck of cards in the
memory game. It
s a pretty simple extension of the Array class that
adds the ability to shuffle. In addition to wanting the shuffle feature,
'
 
Search WWH ::




Custom Search