Game Development Reference
In-Depth Information
if (i == 0 || _content.puzzle.row[i-1].charAt(j) ==
CrosswordTile.EMPTY) {
tile.downIndex = _wordListDown.push(new Array());
startOfWord = true;
if (startOfWord) {
tile.wordIndex = totalWords++;
if (tile.acrossIndex < 0) {
var previousAcrossTile:CrosswordTile = _tile
tile.acrossIndex = previousAcrossTile.
if (tile.downIndex
0) {
var previousDownTile:CrosswordTile = _tileList
tile.downIndex = previousDownTile.downIndex;
This section of the method performs a series of checks to deter-
mine the tile
s current state (in-use or blacked-out) and the words
with which it is associated. First, we check whether the tile is sup-
posed to be empty. If so, we stop there and don
t include it in any
word lists. Next, we determine whether the tile is the starting letter
of a word, either across or down. We ascertain this by checking if
the tile immediately to the left or top of the current tile is a blank.
If it is the start of a new word, we add it to the across list and/or
the down list. We also increment the total number of words coun-
ter and set the tile
s wordIndex to this number. If you recall from
the CrosswordTile class, when the wordIndex is set, it adds this
number to the upper left hand corner TextField. This is the number
that will be used to match the tile to its corresponding clue. If the
tile is not the start of a word, its acrossIndex and downIndex will
still be the default value of -1. We then look up the previous tile to
both the left and above the tile to use its same indices and add it
to the across list, down list, or both. At this point, the tile shares
association with words in the across word list, down word list, and
the beginning letter of each word.
tile.x = j*tile.width;
Search Nedrilad ::

Custom Search