Game Development Reference
In-Depth Information
function get tempX():Number;
function set tempX(value:Number):void;
function get tempY():Number;
function set tempY(value:Number):void;
}
}
Note the use of Vector3D objects, much like in the examples of
Chapter 11.
The IEnemy Interface
Similar to the IPlayer interface, IEnemy also extends ISprite. In fact,
it repeats a couple of the accessors from IPlayer, but it didn
tmake
sense to make them part of ISprite just so they would be inherited.
'
package com.flashgamebook.engines.platformer.sprites {
import flash.geom.Vector3D;
import com.flashgamebook.engines.platformer.
GridReference;
public interface IEnemy extends ISprite {
function update():void;
function get tempX():Number;
function set tempX(value:Number):void;
function get tempY():Number;
function set tempY(value:Number):void;
function get receivesForces():Boolean;
function get motion():Vector3D;
function get gridReference():GridReference;
function set gridReference(value:GridReference):
void;
}
}
One unique aspect of this interface is that enemies must keep
track of where they currently are on the collision grid because they
are the only type of entity besides the player that can move. As
such, implementors of this interface have an accessor for a GridRe-
ference object, which we
'
ll look at soon.
The IItem Interface
Although admittedly an awkward name for an interface, IItem is
used for any items the player can pick up.
Search Nedrilad ::




Custom Search