Packagecitrus.objects.platformer.box2d
Classpublic class Missile
InheritanceMissile Inheritance Box2DPhysicsObject Inheritance APhysicsObject Inheritance CitrusObject Inheritance Object

A missile is an object that moves at a particular trajectory and speed, and explodes when it comes into contact with something. Often you will want the object that it exploded on to also die (or at least get hurt), such as a hero or an enemy. Since the missile can potentially be used for any purpose, by default the missiles do not do any damage or kill the object that they collide with. You will have to handle this manually using the onExplode() handler.



Public Properties
 PropertyDefined By
  angle : Number = 0
In degrees, the angle that the missile will fire at.
Missile
 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
 InheritedendContactCallEnabled : Boolean
This flag determines if the handleEndContact method is called or not.
Box2DPhysicsObject
  explodeDuration : Number = 1000
In milliseconds, how long the explode animation lasts before the missile object is destroyed.
Missile
  fuseDuration : Number = 10000
In milliseconds, how long the missile lasts before it explodes if it doesn't touch anything.
Missile
 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
  onExplode : Signal
Dispatched when the missile explodes.
Missile
 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
  rotation : Number
[override]
Missile
  speed : Number = 2
The speed that the missile moves at.
Missile
 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
 Inheritedwidth : Number
This can only be set in the constructor parameters.
Box2DPhysicsObject
 Inheritedx : Number
Box2DPhysicsObject
 Inheritedy : Number
Box2DPhysicsObject
 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
  _contact : IBox2DPhysicsObject
Missile
 Inherited_endContactCallEnabled : Boolean = false
Box2DPhysicsObject
  _exploded : Boolean = false
Missile
  _explodeTimeoutID : uint = 0
Missile
 Inherited_fixture : b2Fixture
Box2DPhysicsObject
 Inherited_fixtureDef : b2FixtureDef
Box2DPhysicsObject
  _fuseDurationTimeoutID : uint = 0
Missile
 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
 Inherited_postContactCallEnabled : Boolean = false
Box2DPhysicsObject
 Inherited_preContactCallEnabled : Boolean = false
Box2DPhysicsObject
 Inherited_radius : Number = 0
APhysicsObject
 Inherited_rotation : Number = 0
APhysicsObject
 Inherited_shape : b2Shape
Box2DPhysicsObject
 Inherited_timeDelta : Number
The time elasped between two update call.
CitrusObject
 Inherited_touchable : Boolean = false
APhysicsObject
  _velocity : b2Vec2
Missile
 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
  
Missile(name:String, params:Object = null)
Missile
  
addPhysics():void
[override]
Missile
  
destroy():void
[override]
Missile
  
explode():void
Explodes the missile, it shouldn't collide with anything anymore.
Missile
 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]
Missile
 Inherited
handleEndContact(contact:b2Contact):void
Override this method to handle the end contact collision.
Box2DPhysicsObject
 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 this method if you want to perform some actions before the collision (deactivate).
Box2DPhysicsObject
 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]
Missile
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]
Missile
 Inherited
This method will often need to be overridden to provide additional definition to the Box2D fixture object.
Box2DPhysicsObject
 Inherited
This method will often need to be overridden to provide additional definition to the Box2D joint object.
Box2DPhysicsObject
  
Missile
  
Missile
Property Detail
_contactproperty
protected var _contact:IBox2DPhysicsObject

_explodedproperty 
protected var _exploded:Boolean = false

_explodeTimeoutIDproperty 
protected var _explodeTimeoutID:uint = 0

_fuseDurationTimeoutIDproperty 
protected var _fuseDurationTimeoutID:uint = 0

_velocityproperty 
protected var _velocity:b2Vec2

angleproperty 
public var angle:Number = 0

In degrees, the angle that the missile will fire at. Right is zero degrees, going clockwise.

explodeDurationproperty 
public var explodeDuration:Number = 1000

In milliseconds, how long the explode animation lasts before the missile object is destroyed.

fuseDurationproperty 
public var fuseDuration:Number = 10000

In milliseconds, how long the missile lasts before it explodes if it doesn't touch anything.

onExplodeproperty 
public var onExplode:Signal

Dispatched when the missile explodes. Passes two parameters: 1. The Missile (Missile) 2. The Object it exploded on (Box2DPhysicsObject)

rotationproperty 
rotation:Number[override]


Implementation
    public function get rotation():Number
    public function set rotation(value:Number):void
speedproperty 
public var speed:Number = 2

The speed that the missile moves at.

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



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

defineBody()method 
override protected function defineBody():void

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

explode()method 
public function explode():void

Explodes the missile, it shouldn't collide with anything anymore.

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

Parameters

contact:b2Contact

killMissile()method 
protected function killMissile():void

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

Parameters

timeDelta:Number

updateAnimation()method 
protected function updateAnimation():void