Game Development Reference
In-Depth Information
timeString += String(seconds);
timeElapsedText.text = timeString;
This set of six methods comprises the accessor, or getter/setter,
methods that we
ll use for this class. The get function simply
returns the value of the private variable. The set function sets the
private variable and also updates the corresponding TextField
object. In the case of the timeElapsed property, in particular, the
time must be updated from just a number of seconds to a standard
formatting of
public function init(sourceImage:ISourceImage,
imageWidth:int = 0,
imageHeight:int = 0,
boardPosition:Point = null):void {
_totalPieces = piecesLeft = rows * columns;
movesMade = 0;
_sourceImage = sourceImage;
_gameBoard = new GameBoard(_sourceImage, GamePiece, rows,
columns, imageWidth, imageHeight);
if (!boardPosition) boardPosition = new Point();
_gameBoard.x = boardPosition.x;
_gameBoard.y = boardPosition.y;
addChildAt(_gameBoard, 0);
public function startGame():void {
pauseBeforeGameOver, false, 0, true);
pieceSwap, false, 0, true);
pieceLock, false, 0, true);
timeElapsed = 0;
You may have noticed that these two public methods are the
same two called by the MixUp class earlier. The init function sets
upthegameforplay,andstartGame activates the GameBoard
for mouse input and starts the Timer. There are a number of
Search Nedrilad ::

Custom Search