| Package | org.ffilmation.engine.elements |
| Class | public class fBullet |
| Inheritance | fBullet fRenderableElement fElement 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
| Property | Defined by | ||
|---|---|---|---|
![]() | castShadows : Boolean = true
Boolean value indicating if this object casts shadows.
| fRenderableElement | |
![]() | container : MovieClip WARNING!!!: This property only exists when the scene is being rendered and the graphic elements have been created. | fRenderableElement | |
![]() | controller : fEngineElementController
Retrieves controller from this element
| fElement | |
![]() | customData : Object
As elements are not defined as "dynamic", this property can be used to store extra info about this element at run-time.
| fElement | |
![]() | flashClip : 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 | |
![]() | id : String
The string identifier of this element.
| fElement | |
![]() | receiveLights : Boolean = true
Boolean value indicating if this object receives lighting.
| fRenderableElement | |
![]() | receiveShadows : Boolean = true
Boolean value indicating if this object receives shadows.
| fRenderableElement | |
![]() | solid : 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 | ||
![]() | x : Number
X coordinate fot this element
| fElement | |
![]() | xmlObj : XML
This is the XML node from the scene XML that generated this element.
| fElement | |
![]() | y : Number
Y coordinate for this element
| fElement | |
![]() | z : Number
Z coordinate for this element
| fElement | |
| Constant | Defined by | ||
|---|---|---|---|
![]() | HIDE : String = "renderableElementHide" [static]
The fRenderableElement.HIDE constant defines the value of the
type property of the event object for a renderableElementHide event. | fRenderableElement | |
![]() | MOVE : String = "elementmove" [static]
The fElement.MOVE constant defines the value of the
type property of the event object for a elementmove event. | fElement | |
![]() | NEWCELL : 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 | ||
![]() | SHOW : String = "renderableElementShow" [static]
The fRenderableElement.SHOW constant defines the value of the
type property of the event object for a renderableElementShow event. | fRenderableElement | |
| speedx | property |
public var speedx:NumberSpeed of bullet along X-axis, in pixels per frame. Can be altered during movement.
| speedy | property |
public var speedy:NumberSpeed of bullet along Y-axis, in pixels per frame. Can be altered during movement.
| speedz | property |
public var speedz:NumberSpeed of bullet along Z-axis, in pixels per frame. Can be altered during movement.
| SHOT | constant |
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_THROUGH | constant |
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