Game Development Reference
In-Depth Information
￿
RulesPanel: Handles display and closure of the How To Play
Popup
￿
Game: Shows GameBoard, timer, and UI elements
￿
GameBoard: Creates puzzle from source image, shuffles pieces,
and handles game logic
￿
IGamePiece: An interface that defines the methods for what
constitutes a game piece
￿
GamePiece: Implements IGamePiece and defines specific
behavior for pieces (with regard to animation, mouse
interaction, and so on)
￿
ISourceImage: Base interface for plugging in different image sets
or video for use with the GameBoard
￿
SourceImageEmbedded: Uses images embedded in the SWF
￿
SourceImageCamera: Uses camera feed
￿
GameHistory: Simple data class containing static properties for
the player
'
s performance each time they play a round
￿
Results: Screen displaying game results when the game is over
We
'
ll work through each of these classes and the basic setup of
theFLAonebyone.Sothatwehavesomecontextforthecode
we
ll start with the structure of the MixUp.fla
file. You can open it from the Chapter 13 Examples folder that you
downloaded (or should download) from www.flashgamebook.com .
'
ll be working with, we
'
The Main Document
When you open up MixUp.fla and look at the library and timeline,
you
ll notice a couple of things. First, they are very simple. The
timeline has three labels and three matching pieces of content for
each one: the title screen, the game screen, and the results
screen. They are given their own discrete space on the timeline
for organizational purposes and to simplify screen management.
In the library, there are only a handful of items. Each screen is
contained within its respective clip;thereareacoupleofdifferent
buttons; and there is an image to be used as the source for the
puzzle. Each of the screens is linked to a class with the same
name. If you look at the document properties panel, you
'
ll also
see that the document is pointing to a class called MixUp. We
'
ll
start here first and work our way inward through the structure of
the game.
'
The MixUp Class
This document class file controls the main logic for navigating
between the screens in the game and displaying the rules panel. As
the top-level in our game, it is the one class that persists through-
out the entire experience and is in the unique position of storing
Search Nedrilad ::




Custom Search