Game Development Reference
In-Depth Information
import flash.events.IEventDispatcher;
import flash.geom.Rectangle;
public interface ISprite extends IEventDispatcher {
function get x():Number;
function set x(value:Number):void;
function get y():Number;
function set y(value:Number):void;
function get width():Number;
function set width(value:Number):void;
function get height():Number;
function set height(value:Number):void;
function get rotation():Number;
function set rotation(value:Number):void;
function get hitArea():Sprite;
function getRect(coordinateSpace:DisplayObject):
Rectangle;
function get name():String;
function set name(value:String):void;
}
}
You probably noted that all of these methods and accessors are
included in DisplayObjects, specifically Sprites. Implementing this
interface on a Sprite-based class will require no extra functionality,
but makes it more flexible in the engine by referring to this inter-
face rather than any particular DisplayObject type.
The IPlayer Interface
Wherever the engine refers to the character the user controls in the
game, it is done through the IPlayer interface, which extends
ISprite.
package com.flashgamebook.engines.platformer.sprites {
import flash.geom.Vector3D;
public interface IPlayer extends ISprite {
function get netForce():Vector3D;
function set netForce(value:Vector3D):void;
function get isJumping():Boolean;
function set isJumping(value:Boolean):void;
function get isFalling():Boolean;
function set isFalling(value:Boolean):void;
function update():void;
Search Nedrilad ::




Custom Search