Game Development Reference
In-Depth Information
else if (_selectedWord == downWord &&
_selectedTile != tile) _selectedWord =
downWord;
else _selectedWord = acrossWord;
for (var i:int = 0; i < _selectedWord.length; i++) {
if (_selectedWord[i] == tile) {
_selectedWord[i].transform.color
Transform = tileSelectedColor;
} else {
_selectedWord[i].transform.color
Transform = wordSelectedColor;
}
}
_selectedTile = tile;
var wordNumber:int = _selectedWord[0].wordIndex;
if (_selectedWord == downWord) {
_crosswordClue.text = String(wordNumber) +
"
+ (_content.clues.down[tile.
downIndex-1] ||
Down:
"
""
);
} else {
_crosswordClue.text = String(wordNumber) +
" Across: " + (_content.clues.across[tile.
acrossIndex-1] || "" );
}
}
The selectTile method is called when the player clicks a tile. To
provide the expected user feedback, this method needs to (1) high-
light the selected tile, (2) highlight the word with which the tile is
associated, and (3) display the hint associated with the tile. First,
we look up the across and down words the tile is associated with
and then call clearSelection , which we will look at shortly. Suffice it
to say now that clearSelection will nullify any other currently
selected tiles. Next, we check whether the player clicked on a
blacked-out tile; if so, we clear the clue text, disable the keyboard
input if it is active, and exit the function. If the _selectedTile prop-
erty is null, meaning no tile was previously selected, we add a lis-
tener for the keyboard input so that players can start to type letters
once they click a tile. We now need to know whether to use the
tile
s associated across or down word. By default, if no previous
word was selected, we use the tile
'
sacrossword.Weusemany
conditions to ensure that if a tile is selected as part of a down
word, and another tile in that word is clicked, it will keep the
same word selected. We also check to see if the same tile was
clicked twice; if so, we want to select the opposite type of the word
that is currently selected. For instance, if an across word is selected
'
Search Nedrilad ::




Custom Search