Game Development Reference
In-Depth Information
_wordListDown = new Array();
To tint a tile when it is selected, we create two color transforms
(in this case, versions of light blue). One is used for the specific tile
that is selected, and a lighter one will be used for the word asso-
ciated with that tile. The engine employs a number of variables to
keep track of various pieces of data. The _content XML variable
will store the puzzle data once it is loaded from an external file. It
also keeps track of the width and height of the puzzle, a list of all
the tiles in the play (including blacked-out ones), lists of the hori-
zontal and vertical words, references to the currently selected tile
and the word, and a reference to the CrosswordClue class we cre-
ated earlier. Finally, the constructor accepts an XML object contain-
ing the puzzle content as a parameter. It then initializes the three
lists and calls createPuzzle, which we will look at next.
protected function createPuzzle() {
_puzzleWidth = _content.@width;
_puzzleHeight = _content.@height;
var totalWords:int = 1;
var tile:CrosswordTile;
for (var i:int = 0; i < _puzzleHeight; i++) {
for (var j:int = 0; j < _puzzleWidth; j++) {
var letter:String = _content.puzzle.
tile = new CrosswordTile(letter); = j.toString() + " _ " + i.toString();
tile.tileIndex = new Point(j, i);
if (letter != CrosswordTile.EMPTY) {
var startOfWord:Boolean = false;
if (j == 0 || _content.puzzle.
row[i].charAt(j-1) == " _ " ){
tile.acrossIndex =
(new Array());
startOfWord = true;
if (i == 0 || _content.puzzle.
row[i-1].charAt(j) == " _ " ){
tile.downIndex =
(new Array());
Search Nedrilad ::

Custom Search