Game Development Reference
In-Depth Information
useful data such as the current session
'
s game history (for showing
best scores, average scores, and so on).
public class MixUp extends MovieClip {
static public const FRAME_TITLE:String = " title " ;
static public const FRAME_GAME:String = " game " ;
static public const FRAME_RESULTS:String = " results " ;
static public var gameHistory:Array = new Array();
protected var _imageNameList:Array = [ " goldengate.jpg " ];
protected var _imageList:Vector. < ISourceImage > ;
public var title:Title;
public var game:Game;
public var results:Results;
public function MixUp() {
enumerateFrameLabels();
addEventListener(FRAME_TITLE, setupTitle, false,
0, true);
addEventListener(FRAME_GAME, setupGame, false, 0,
true);
addEventListener(FRAME_RESULTS, setupResults,
false, 0, true);
createImagePool();
}
protected function createImagePool():void {
_imageList = new Vector. < ISourceImage > ();
for each (var imageName:String in _imageNameList)
_imageList.push(new SourceImageEmbedded
(imageName));
}
There are only a few variables in this class: one for each of the
main screens, an Array for the game history, and a constant defining
each of the frame labels. In addition to these public properties are
twolists.Onewillstorethelistofavailableimagestouseforthe
puzzle (in this case, the one that is embedded in the library), and
the other will store the list of image objects that will be used by the
game. In the constructor for the class, enumerateFrameLabels is
called and listeners are added to each of the frame names. It also
calls createImagePool, which runs through the list of image names
and creates new SourceImageEmbedded objects for each of them.
More information will be provided on this later when we get to the
in-game classes.
Search Nedrilad ::




Custom Search