Game Development Reference
In-Depth Information
subclasses that extend CrosswordPuzzle, which could get cumbersome
quickly. It is easier to set up the puzzle dynamically based on the
puzzle data. Like the CrosswordClue, CrosswordPuzzle extends Sprite;
since it is being generated dynamically, it will not use frames.
package {
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.geom.Point;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class CrosswordPuzzle extends Sprite {
}
}
In the basic package definition, we will need to be able to listen
for both Keyboard and Mouse events, and we will use the Color-
Transform class (the code version of the Color properties drop-
down on a timeline-based symbol) to tint tiles that are selected.
Next we define the constants and properties of the class, as well as
the constructor.
// CLASS CONSTANTS
static public const tileSelectedColor:ColorTransform = new
ColorTransform(0, 1, 1, 1, 0, 0, 0, 0);
static public const wordSelectedColor:ColorTransform = new
ColorTransform(.7, 1, 1, 1, 0, 0, 0, 0);
// PROTECTED VARIABLES
protected var _content:XML;
protected var _puzzleHeight:int;
protected var _puzzleWidth:int;
protected var _tileList:Array;
protected var _wordListAcross:Array;
protected var _wordListDown:Array;
protected var _selectedWord:Array;
protected var _selectedTile:CrosswordTile;
protected var _crosswordClue:CrosswordClue;
public function CrosswordPuzzle(content:XML){
_content = content;
_tileList = new Array();
_wordListAcross = new Array();
Search Nedrilad ::




Custom Search