Packagecitrus.objects
Classpublic class APhysicsObject
InheritanceAPhysicsObject Inheritance CitrusObject Inheritance Object
Subclasses AwayPhysicsObject, Box2DPhysicsObject, NapePhysicsObject

An abstract template used by every physics object.



Public Properties
 PropertyDefined By
  animation : String
Animations management works the same way than label whether it uses MovieClip, SpriteSheet or whatever.
APhysicsObject
  art : ICitrusArt
[read-only]
APhysicsObject
  group : uint
The group is similar to a z-index sorting.
APhysicsObject
 InheritedhideParamWarnings : Boolean = false
[static]
CitrusObject
 InheritedID : uint
[read-only]
CitrusObject
  inverted : Boolean
[read-only] Used to invert the view on the y-axis, number of animations friendly!
APhysicsObject
 Inheritedkill : Boolean = false
Set it to true if you want to remove, clean and destroy the object.
CitrusObject
 Inheritedname : String
A name to identify easily an objet.
CitrusObject
  offsetX : Number
offsetX allows to move graphics on x axis compared to their initial point.
APhysicsObject
  offsetY : Number
offsetY allows to move graphics on y axis compared to their initial point.
APhysicsObject
  parallaxX : Number
APhysicsObject
  parallaxY : Number
APhysicsObject
  registration : String
Flash registration point is topLeft, whereas physics engine use mostly center.
APhysicsObject
  touchable : Boolean
APhysicsObject
 Inheritedtype : String = classicObject
Added to the CE's render list via the State and the add method.
CitrusObject
 InheritedupdateCallEnabled : Boolean = false
This property prevent the update method to be called by the enter frame, it will save performances.
CitrusObject
  view : *
The view can be a class, a string to a file, or a display object.
APhysicsObject
  visible : Boolean
You can easily change if an object is visible or not.
APhysicsObject
Protected Properties
 PropertyDefined By
  _animation : String
APhysicsObject
  _art : ICitrusArt
APhysicsObject
 Inherited_ce : CitrusEngine
CitrusObject
 Inherited_initialized : Boolean = false
CitrusObject
  _inverted : Boolean = false
APhysicsObject
  _parallaxX : Number = 1
APhysicsObject
  _parallaxY : Number = 1
APhysicsObject
 Inherited_params : Object
CitrusObject
  _radius : Number = 0
APhysicsObject
  _rotation : Number = 0
APhysicsObject
 Inherited_timeDelta : Number
The time elasped between two update call.
CitrusObject
  _touchable : Boolean = false
APhysicsObject
  _view : *
APhysicsObject
  _visible : Boolean = true
APhysicsObject
  _x : Number = 0
APhysicsObject
  _y : Number = 0
APhysicsObject
  _z : Number = 0
APhysicsObject
Public Methods
 MethodDefined By
  
APhysicsObject(name:String, params:Object = null)
APhysicsObject
  
addPhysics():void
This function will add the physics stuff to the object.
APhysicsObject
  
destroy():void
[override] Destroy your physics objects!
APhysicsObject
  
This method doesn't depend of your application enter frame.
APhysicsObject
  
Used for abstraction on body.
APhysicsObject
  
called when the art changes.
APhysicsObject
  
handleArtReady(citrusArt:ICitrusArt):void
called when the art is created (and loaded if loading is required)
APhysicsObject
 Inherited
initialize(poolObjectParams:Object = null):void
Call in the constructor if the Object is added via the State and the add method.
CitrusObject
 Inherited
setParams(object:Object, params:Object):void
The initialize method usually calls this.
CitrusObject
 Inherited
toString():String
CitrusObject
  
update(timeDelta:Number):void
[override] You should override this method to extend the functionality of your physics object.
APhysicsObject
Property Detail
_animationproperty
protected var _animation:String

_artproperty 
protected var _art:ICitrusArt

_invertedproperty 
protected var _inverted:Boolean = false

_parallaxXproperty 
protected var _parallaxX:Number = 1

_parallaxYproperty 
protected var _parallaxY:Number = 1

_radiusproperty 
protected var _radius:Number = 0

_rotationproperty 
protected var _rotation:Number = 0

_touchableproperty 
protected var _touchable:Boolean = false

_viewproperty 
protected var _view:*

_visibleproperty 
protected var _visible:Boolean = true

_xproperty 
protected var _x:Number = 0

_yproperty 
protected var _y:Number = 0

_zproperty 
protected var _z:Number = 0

animationproperty 
animation:String

Animations management works the same way than label whether it uses MovieClip, SpriteSheet or whatever.


Implementation
    public function get animation():String
    public function set animation(value:String):void
artproperty 
art:ICitrusArt  [read-only]


Implementation
    public function get art():ICitrusArt
groupproperty 
group:uint

The group is similar to a z-index sorting. Default is 0, 1 is over.


Implementation
    public function get group():uint
    public function set group(value:uint):void
invertedproperty 
inverted:Boolean  [read-only]

Used to invert the view on the y-axis, number of animations friendly!


Implementation
    public function get inverted():Boolean
offsetXproperty 
offsetX:Number

offsetX allows to move graphics on x axis compared to their initial point.


Implementation
    public function get offsetX():Number
    public function set offsetX(value:Number):void
offsetYproperty 
offsetY:Number

offsetY allows to move graphics on y axis compared to their initial point.


Implementation
    public function get offsetY():Number
    public function set offsetY(value:Number):void
parallaxXproperty 
parallaxX:Number


Implementation
    public function get parallaxX():Number
    public function set parallaxX(value:Number):void
parallaxYproperty 
parallaxY:Number


Implementation
    public function get parallaxY():Number
    public function set parallaxY(value:Number):void
registrationproperty 
registration:String

Flash registration point is topLeft, whereas physics engine use mostly center. You can change the registration point thanks to this property.


Implementation
    public function get registration():String
    public function set registration(value:String):void
touchableproperty 
touchable:Boolean


Implementation
    public function get touchable():Boolean
    public function set touchable(value:Boolean):void
viewproperty 
view:*

The view can be a class, a string to a file, or a display object. It must be supported by the view you target.


Implementation
    public function get view():*
    public function set view(value:any):void
visibleproperty 
visible:Boolean

You can easily change if an object is visible or not. It hasn't any impact on physics computation.


Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
Constructor Detail
APhysicsObject()Constructor
public function APhysicsObject(name:String, params:Object = null)



Parameters
name:String
 
params:Object (default = null)
Method Detail
addPhysics()method
public function addPhysics():void

This function will add the physics stuff to the object. It's automatically called when the object is added to the state.

destroy()method 
override public function destroy():void

Destroy your physics objects!

fixedUpdate()method 
public function fixedUpdate():void

This method doesn't depend of your application enter frame. Ideally, the time between two calls never change. In this method you will apply any velocity/force logic.

getBody()method 
public function getBody():*

Used for abstraction on body. There is also a getter on the body defined by each engine to keep body's type.

Returns
*
handleArtChanged()method 
public function handleArtChanged(oldArt:ICitrusArt):void

called when the art changes. the argument is the art with its previous content so that you can remove event listeners from it for example.

Parameters

oldArt:ICitrusArt — the art

handleArtReady()method 
public function handleArtReady(citrusArt:ICitrusArt):void

called when the art is created (and loaded if loading is required)

Parameters

citrusArt:ICitrusArt — the art

update()method 
override public function update(timeDelta:Number):void

You should override this method to extend the functionality of your physics object. This is where you will want to do any velocity/force logic.

Parameters

timeDelta:Number