Packagecitrus.objects.platformer.box2d
Classpublic class MovingPlatform
InheritanceMovingPlatform Inheritance Platform Inheritance Box2DPhysicsObject Inheritance APhysicsObject Inheritance CitrusObject Inheritance Object
Subclasses Treadmill

A platform that moves between two points. The MovingPlatform has several properties that can customize it.



Public Properties
 PropertyDefined By
 Inheritedanimation : String
Animations management works the same way than label whether it uses MovieClip, SpriteSheet or whatever.
APhysicsObject
 Inheritedart : ICitrusArt
[read-only]
APhysicsObject
 InheritedbeginContactCallEnabled : Boolean
This flag determines if the handleBeginContact method is called or not.
Box2DPhysicsObject
 Inheritedbody : b2Body
[read-only] A direct reference to the Box2D body associated with this object.
Box2DPhysicsObject
 Inheriteddepth : Number
[read-only] No depth in a 2D Physics world.
Box2DPhysicsObject
  enabled : Boolean = true
Whether or not the MovingPlatform can move, no matter the condition.
MovingPlatform
 InheritedendContactCallEnabled : Boolean
This flag determines if the handleEndContact method is called or not.
Box2DPhysicsObject
  endX : Number
The ending X position of the MovingPlatform.
MovingPlatform
  endY : Number
The ending Y position of the MovingPlatform.
MovingPlatform
 Inheritedgroup : uint
The group is similar to a z-index sorting.
APhysicsObject
 Inheritedheight : Number
This can only be set in the constructor parameters.
Box2DPhysicsObject
 InheritedhideParamWarnings : Boolean = false
[static]
CitrusObject
 InheritedID : uint
[read-only]
CitrusObject
 Inheritedinverted : 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
 InheritedoffsetX : Number
offsetX allows to move graphics on x axis compared to their initial point.
APhysicsObject
 InheritedoffsetY : Number
offsetY allows to move graphics on y axis compared to their initial point.
APhysicsObject
 InheritedoneWay : Boolean
Makes the platform only collidable when falling from above it.
Platform
 InheritedparallaxX : Number
APhysicsObject
 InheritedparallaxY : Number
APhysicsObject
 Inheritedpoints : Array
Used to define vertices' x and y points.
Box2DPhysicsObject
 InheritedpostContactCallEnabled : Boolean
This flag determines if the handlePostSolve method is called or not.
Box2DPhysicsObject
 InheritedpreContactCallEnabled : Boolean
This flag determines if the handlePreSolve method is called or not.
Box2DPhysicsObject
 Inheritedradius : Number
This can only be set in the constructor parameters.
Box2DPhysicsObject
 Inheritedregistration : String
Flash registration point is topLeft, whereas physics engine use mostly center.
APhysicsObject
 Inheritedrotation : Number
Box2DPhysicsObject
  speed : Number = 1
The speed at which the moving platform travels.
MovingPlatform
  startX : Number
The initial starting X position of the MovingPlatform, and the place it returns to when it reaches the end destination.
MovingPlatform
  startY : Number
The initial starting Y position of the MovingPlatform, and the place it returns to when it reaches the end destination.
MovingPlatform
 Inheritedtouchable : 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
 Inheritedvelocity : Array
Box2DPhysicsObject
 Inheritedview : *
The view can be a class, a string to a file, or a display object.
APhysicsObject
 Inheritedvisible : Boolean
You can easily change if an object is visible or not.
APhysicsObject
  waitForPassenger : Boolean = false
If set to true, the MovingPlatform will not move unless there is a passenger.
MovingPlatform
 Inheritedwidth : Number
This can only be set in the constructor parameters.
Box2DPhysicsObject
  x : Number
[override]
MovingPlatform
  y : Number
[override]
MovingPlatform
 Inheritedz : Number
[read-only]
Box2DPhysicsObject
Protected Properties
 PropertyDefined By
 Inherited_animation : String
APhysicsObject
 Inherited_art : ICitrusArt
APhysicsObject
 Inherited_beginContactCallEnabled : Boolean = false
Box2DPhysicsObject
 Inherited_body : b2Body
Box2DPhysicsObject
 Inherited_bodyDef : b2BodyDef
Box2DPhysicsObject
 Inherited_box2D : Box2D
Box2DPhysicsObject
 Inherited_ce : CitrusEngine
CitrusObject
  _end : MathVector
MovingPlatform
 Inherited_endContactCallEnabled : Boolean = false
Box2DPhysicsObject
 Inherited_fixture : b2Fixture
Box2DPhysicsObject
 Inherited_fixtureDef : b2FixtureDef
Box2DPhysicsObject
  _forward : Boolean = true
MovingPlatform
 Inherited_height : Number = 1
Box2DPhysicsObject
 Inherited_initialized : Boolean = false
CitrusObject
 Inherited_inverted : Boolean = false
APhysicsObject
 Inherited_parallaxX : Number = 1
APhysicsObject
 Inherited_parallaxY : Number = 1
APhysicsObject
 Inherited_params : Object
CitrusObject
  _passengers : Vector.<b2Body>
MovingPlatform
 Inherited_postContactCallEnabled : Boolean = false
Box2DPhysicsObject
 Inherited_preContactCallEnabled : Boolean = false
Box2DPhysicsObject
 Inherited_radius : Number = 0
APhysicsObject
 Inherited_rotation : Number = 0
APhysicsObject
 Inherited_shape : b2Shape
Box2DPhysicsObject
  _start : MathVector
MovingPlatform
 Inherited_timeDelta : Number
The time elasped between two update call.
CitrusObject
 Inherited_touchable : Boolean = false
APhysicsObject
 Inherited_vertices : Array
Box2DPhysicsObject
 Inherited_view : *
APhysicsObject
 Inherited_visible : Boolean = true
APhysicsObject
 Inherited_width : Number = 1
Box2DPhysicsObject
 Inherited_x : Number = 0
APhysicsObject
 Inherited_y : Number = 0
APhysicsObject
 Inherited_z : Number = 0
APhysicsObject
Public Methods
 MethodDefined By
  
MovingPlatform(name:String, params:Object = null)
MovingPlatform
 Inherited
addPhysics():void
[override] All your init physics code must be added in this method, no physics code into the constructor.
Box2DPhysicsObject
  
destroy():void
[override]
MovingPlatform
 Inherited
This method doesn't depend of your application enter frame.
APhysicsObject
 Inherited
[override]
Box2DPhysicsObject
 Inherited
called when the art changes.
APhysicsObject
 Inherited
handleArtReady(citrusArt:ICitrusArt):void
called when the art is created (and loaded if loading is required)
APhysicsObject
  
handleBeginContact(contact:b2Contact):void
[override]
MovingPlatform
  
handleEndContact(contact:b2Contact):void
[override]
MovingPlatform
 Inherited
handlePostSolve(contact:b2Contact, impulse:b2ContactImpulse):void
Override this method if you want to perform some actions after the collision.
Box2DPhysicsObject
 Inherited
handlePreSolve(contact:b2Contact, oldManifold:b2Manifold):void
[override]
Platform
 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]
MovingPlatform
Protected Methods
 MethodDefined By
 Inherited
Box2DPhysicsObject
 Inherited
createBody():void
This method will often need to be overridden to customize the Box2D body object.
Box2DPhysicsObject
 Inherited
This method will often need to be overridden to customize the Box2D fixture object.
Box2DPhysicsObject
 Inherited
This method will often need to be overridden to customize the Box2D joint object.
Box2DPhysicsObject
 Inherited
This method will often need to be overridden to customize the Box2D shape object.
Box2DPhysicsObject
  
defineBody():void
[override]
MovingPlatform
 Inherited
[override]
Platform
 Inherited
This method will often need to be overridden to provide additional definition to the Box2D joint object.
Box2DPhysicsObject
Property Detail
_endproperty
protected var _end:MathVector

_forwardproperty 
protected var _forward:Boolean = true

_passengersproperty 
protected var _passengers:Vector.<b2Body>

_startproperty 
protected var _start:MathVector

enabledproperty 
public var enabled:Boolean = true

Whether or not the MovingPlatform can move, no matter the condition.

endXproperty 
endX:Number

The ending X position of the MovingPlatform.


Implementation
    public function get endX():Number
    public function set endX(value:Number):void
endYproperty 
endY:Number

The ending Y position of the MovingPlatform.


Implementation
    public function get endY():Number
    public function set endY(value:Number):void
speedproperty 
public var speed:Number = 1

The speed at which the moving platform travels.

startXproperty 
startX:Number

The initial starting X position of the MovingPlatform, and the place it returns to when it reaches the end destination.


Implementation
    public function get startX():Number
    public function set startX(value:Number):void
startYproperty 
startY:Number

The initial starting Y position of the MovingPlatform, and the place it returns to when it reaches the end destination.


Implementation
    public function get startY():Number
    public function set startY(value:Number):void
waitForPassengerproperty 
public var waitForPassenger:Boolean = false

If set to true, the MovingPlatform will not move unless there is a passenger.

xproperty 
x:Number[override]


Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number[override]


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
MovingPlatform()Constructor
public function MovingPlatform(name:String, params:Object = null)



Parameters
name:String
 
params:Object (default = null)
Method Detail
defineBody()method
override protected function defineBody():void

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

handleBeginContact()method 
override public function handleBeginContact(contact:b2Contact):void

Parameters

contact:b2Contact

handleEndContact()method 
override public function handleEndContact(contact:b2Contact):void

Parameters

contact:b2Contact

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

Parameters

timeDelta:Number