Game Development Reference
In-Depth Information
}
public function set tempY(value:Number):void {
_tempY = value;
}
public function update():void {
}
override public function get hitArea():Sprite {
return this;
}
}
}
Note that the hitArea accessor can be overridden to return
any Sprite you wanted to use as the rectangle for collision test-
ing. In this case, we
'
re just using the bounding box of the Sprite
itself.
The Enemy Class
This class implements the IEnemy interface.
package example {
import com.flashgamebook.engines.platformer.sprites.
IEnemy;
import com.flashgamebook.engines.platformer.
GridReference;
import flash.display.Sprite;
import flash.geom.Vector3D;
public class Enemy extends Sprite implements IEnemy {
private var _motion:Vector3D = new Vector3D(-20);
private var _tempX:Number;
private var _tempY:Number;
private var _gridReference:GridReference;
public function get tempX():Number {
return _tempX;
}
public function set tempX(value:Number):void {
_tempX = value;
Search Nedrilad ::




Custom Search