Game Development Reference
In-Depth Information
ll look at the TunnelTile class, which the Tunnel class
utilized to build itself. Since the class is pretty short, we
Next we
ll look at it
in its entirety and then explain each method.
public class TunnelTile extends MovieClip {
private var _highlightedTransform:ColorTransform;
private var _normalTransform:ColorTransform;
public function TunnelTile() {
public function activate() {
if (!_normalTransform) _normalTransform = transform.
if (!_highlightedTransform) createHighlight();
transform.colorTransform = _highlightedTransform;
public function deactivate() {
transform.colorTransform = _normalTransform;
private function createHighlight() {
_highlightedTransform = transform.colorTransform;
_highlightedTransform.redOffset = _highlightedTransform.
greenOffset = _highlightedTransform.blueOffset = 50;
The constructor for this class does nothing, as the Tunnel is
responsible for placing and manipulating each tile. The methods
here mainly deal with activating and deactivating the highlight
effect for the tile, as evidenced by their names activate , deactivate ,
and createHighlight . The first time a tile is activated, it stores its
normal color transform (the one given to it by the Tunnel class) in
a private variable for future reference. It also creates a highlighted
version of that transform, which is done by offsetting all the color
values by 50. This creates a tint effect, as thought the tiles were
overlaid with white. That way, when activate is called, the tint
transform is used, and deactivate returns the transform to its pre-
vious state.
gameplay is the Enemy class. It is also very simple, though further
functionality could easily be added.
Search Nedrilad ::

Custom Search