Packageorg.ffilmation.engine.elements
Classpublic class fBullet
InheritancefBullet Inheritance fRenderableElement Inheritance fElement Inheritance flash.events.EventDispatcher

A bullet is also a moving element, but its particular properties demand an specific class. Bullets move very fast, therefore its collisions must be resolved using trajectories instead of coordinates. Also in this engine bullets don't have size to simplify calculations. This doesn't mean they can't look the way you want: you have control of the render but internally, they will behave as a point travelling in space.

As of this release, castSahdows, receiveShadows and receiveLights don't apply to fBullets. fBullets don't get any lighting applied.

YOU CAN'T CREATE INSTANCES OF THIS OBJECT.
Use scene.createBullet() to add new bullets to an scene. They will be destroyed automatically when they hit something.

Note to developers: bullets are reused. Creating new objects is slow, and depending on your game you could have a lot being created and destroyed. The engine uses an object pool to reuse "dead" bullets and minimize the amount of new() calls. This is transparent to you but I think this information can help tracking weird bugs

See also

org.ffilmation.engine.core.fScene.createBullet()


Public Properties
 PropertyDefined by
 InheritedcastShadows : Boolean = true
Boolean value indicating if this object casts shadows.
fRenderableElement
 Inheritedcontainer : MovieClip

WARNING!!!: This property only exists when the scene is being rendered and the graphic elements have been created.

fRenderableElement
 Inheritedcontroller : fEngineElementController
Retrieves controller from this element
fElement
 InheritedcustomData : Object
As elements are not defined as "dynamic", this property can be used to store extra info about this element at run-time.
fElement
 InheritedflashClip : MovieClip
A reference to the library movieclip that was attached to create the element, so you can acces methods inside, nested clips or whatever
fRenderableElement
 Inheritedid : String
The string identifier of this element.
fElement
 InheritedreceiveLights : Boolean = true
Boolean value indicating if this object receives lighting.
fRenderableElement
 InheritedreceiveShadows : Boolean = true
Boolean value indicating if this object receives shadows.
fRenderableElement
 Inheritedsolid : Boolean = true
Boolean value indicating if this object collides with others.
fRenderableElement
  speedx : Number
Speed of bullet along X-axis, in pixels per frame.
fBullet
  speedy : Number
Speed of bullet along Y-axis, in pixels per frame.
fBullet
  speedz : Number
Speed of bullet along Z-axis, in pixels per frame.
fBullet
 Inheritedx : Number
X coordinate fot this element
fElement
 InheritedxmlObj : XML
This is the XML node from the scene XML that generated this element.
fElement
 Inheritedy : Number
Y coordinate for this element
fElement
 Inheritedz : Number
Z coordinate for this element
fElement
Public Methods
 MethodDefined by
 Inherited
call(what:String, param:* = null):void
Calls a function of the base clip
fRenderableElement
 Inherited
Mouse management
fRenderableElement
 Inherited
distanceTo(x:Number, y:Number, z:Number):Number
Returns the distance of this element to the given coordinate
fElement
 Inherited
Mouse management
fRenderableElement
 Inherited
follow(target:fElement, elasticity:Number = 0):void
Makes element follow target element
fElement
 Inherited
gotoAndPlay(where:*):void
Passes the stardard gotoAndPLay command to the base clip of this element
fRenderableElement
 Inherited
gotoAndStop(where:*):void
Passes the stardard gotoAndStop command to the base clip of this element
fRenderableElement
 Inherited
hide():void
Makes element invisible
fRenderableElement
 Inherited
moveTo(x:Number, y:Number, z:Number):void
Moves the element to a given position
fElement
 Inherited
show():void
Makes element visible
fRenderableElement
 Inherited
stopFollowing(target:fElement):void
Stops element from following another element
fElement
Public Constants
 ConstantDefined by
 InheritedHIDE : String = "renderableElementHide"
[static] The fRenderableElement.HIDE constant defines the value of the type property of the event object for a renderableElementHide event.
fRenderableElement
 InheritedMOVE : String = "elementmove"
[static] The fElement.MOVE constant defines the value of the type property of the event object for a elementmove event.
fElement
 InheritedNEWCELL : String = "elementnewcell"
[static] The fElement.NEWCELL constant defines the value of the type property of the event object for a elementnewcell event.
fElement
  SHOT : String = "bulletshot"
[static] The fBullet.SHOT constant defines the value of the type property of the event object for a bulletshot event.
fBullet
  SHOT_THROUGH : String = "bulletshot_through"
[static] The fBullet.SHOTTHROUGH constant defines the value of the type property of the event object for a bulletshotthrough event.
fBullet
 InheritedSHOW : String = "renderableElementShow"
[static] The fRenderableElement.SHOW constant defines the value of the type property of the event object for a renderableElementShow event.
fRenderableElement
Property detail
speedxproperty
public var speedx:Number

Speed of bullet along X-axis, in pixels per frame. Can be altered during movement.

speedyproperty 
public var speedy:Number

Speed of bullet along Y-axis, in pixels per frame. Can be altered during movement.

speedzproperty 
public var speedz:Number

Speed of bullet along Z-axis, in pixels per frame. Can be altered during movement.

Constant detail
SHOTconstant
public static const SHOT:String = "bulletshot"

The fBullet.SHOT constant defines the value of the type property of the event object for a bulletshot event. The event is dispatched by solid elements when they receive a bullet impact and also by the bullet itself, so you can capture it where it fits you the most

SHOT_THROUGHconstant 
public static const SHOT_THROUGH:String = "bulletshot_through"

The fBullet.SHOTTHROUGH constant defines the value of the type property of the event object for a bulletshotthrough event. The event is dispatched by non-solid elements when they receive a bullet impact (which for non-solid elements will continue its path ) and also by the bullet itself, so you can capture it where it fits you the most