Packagecitrus.core
Classpublic class CitrusObject
InheritanceCitrusObject Inheritance Object
Subclasses APhysicsEngine, APhysicsObject, CitrusSoundSpace, CitrusSprite, Component, Emitter, Entity, Path, SimpleCitrusSolver

CitrusObject is simple. Too simple. Despite its simplicity, it is the foundational object that should be used for all game objects logic you create, such as spaceships, enemies, coins, bosses. CitrusObject is basically an abstract class that gets added to a State instance. The current State calls update on all CitrusObjects. Also, CitrusObjects are useful because they can be initialized with a params object, which can be created via an object parser/factory.



Public Properties
 PropertyDefined By
  hideParamWarnings : Boolean = false
[static]
CitrusObject
  ID : uint
[read-only]
CitrusObject
  kill : Boolean = false
Set it to true if you want to remove, clean and destroy the object.
CitrusObject
  name : String
A name to identify easily an objet.
CitrusObject
  type : String = classicObject
Added to the CE's render list via the State and the add method.
CitrusObject
  updateCallEnabled : Boolean = false
This property prevent the update method to be called by the enter frame, it will save performances.
CitrusObject
Protected Properties
 PropertyDefined By
  _ce : CitrusEngine
CitrusObject
  _initialized : Boolean = false
CitrusObject
  _params : Object
CitrusObject
  _timeDelta : Number
The time elasped between two update call.
CitrusObject
Public Methods
 MethodDefined By
  
CitrusObject(name:String, params:Object = null)
Every Citrus Object needs a name.
CitrusObject
  
destroy():void
Seriously, dont' forget to release your listeners, signals, and physics objects here.
CitrusObject
  
initialize(poolObjectParams:Object = null):void
Call in the constructor if the Object is added via the State and the add method.
CitrusObject
  
setParams(object:Object, params:Object):void
The initialize method usually calls this.
CitrusObject
  
toString():String
CitrusObject
  
update(timeDelta:Number):void
The current state calls update every tick.
CitrusObject
Property Detail
_ceproperty
protected var _ce:CitrusEngine

_initializedproperty 
protected var _initialized:Boolean = false

_paramsproperty 
protected var _params:Object

_timeDeltaproperty 
protected var _timeDelta:Number

The time elasped between two update call.

dataproperty 
citrus_internal var data:Object

data used internally

hideParamWarningsproperty 
public static var hideParamWarnings:Boolean = false

IDproperty 
ID:uint  [read-only]


Implementation
    public function get ID():uint
killproperty 
public var kill:Boolean = false

Set it to true if you want to remove, clean and destroy the object.

last_idproperty 
citrus_internal static var last_id:uint = 0

nameproperty 
public var name:String

A name to identify easily an objet. You may use duplicate name if you wish.

typeproperty 
public var type:String = classicObject

Added to the CE's render list via the State and the add method.

updateCallEnabledproperty 
public var updateCallEnabled:Boolean = false

This property prevent the update method to be called by the enter frame, it will save performances. Set it to true if you want to execute code in the update method.

Constructor Detail
CitrusObject()Constructor
public function CitrusObject(name:String, params:Object = null)

Every Citrus Object needs a name. It helps if it's unique, but it won't blow up if it's not. Also, you can pass parameters into the constructor as well. Hopefully you'll commonly be creating CitrusObjects via an editor, which will parse your shit and create the params object for you.

Parameters
name:String — Name your object.
 
params:Object (default = null) — Any public properties or setters can be assigned values via this object.
Method Detail
destroy()method
public function destroy():void

Seriously, dont' forget to release your listeners, signals, and physics objects here. Either that or don't ever destroy anything. Your choice.

initialize()method 
public function initialize(poolObjectParams:Object = null):void

Call in the constructor if the Object is added via the State and the add method.

If it's a pool object or an entity initialize it yourself.

If it's a component, it should be call by the entity.

Parameters

poolObjectParams:Object (default = null)

setParams()method 
public function setParams(object:Object, params:Object):void

The initialize method usually calls this.

Parameters

object:Object
 
params:Object

toString()method 
public function toString():String

Returns
String
update()method 
public function update(timeDelta:Number):void

The current state calls update every tick. This is where all your per-frame logic should go. Set velocities, determine animations, change properties, etc.

Parameters

timeDelta:Number — This is a ratio explaining the amount of time that passed in relation to the amount of time that was supposed to pass. Multiply your stuff by this value to keep your speeds consistent no matter the frame rate.