Game Development Reference
In-Depth Information
engine will be a puzzle class. At this point, one could argue the
merits of creating a class to define a word, but in terms of practi-
cality a word is nothing more than an array of tiles, so for our pur-
poses we
ll keep it simple. Finally, we need a way to display the
clue for a given word, so we
ll make a class to handle that.
The CrosswordTile Class
The best way to solve a complex problem is to break it down into
smaller, more manageable problems. Such is the case with the
CrosswordTile class. This class will keep track of the correct letter
for a given tile and whether that tile is active in gameplay. To start,
ll set up our class and package.
package {
import flash.display.MovieClip;
import flash.text.TextField;
import flash.geom.Point;
import flash.ui.Keyboard;
public class CrosswordTile extends MovieClip {
Since this class will handle display as well as the data in the tile,
ll extend it from MovieClip and use frames to store its different
Instead of starting with the constructor for the class, let
s outline
the different properties this tile should keep track of. This will con-
sist of both basic public variables and protected variables with pub-
lic getters and setters.
// PUBLIC DisplayObjects
public var letterField:TextField;
public var wordField:TextField;
public var letter:String;
public var acrossIndex:int = -1;
public var downIndex:int = -1;
public var tileIndex:Point;
protected var _wordIndex:uint;
protected var _answer:String;
Search Nedrilad ::

Custom Search