Class Emitter extends DisplayObject
Particle emitter.Methods
Emitter() constructor
Creates new Emitter instance.
Creates new Emitter instance.
simulate(time) method
Simulates current emmitter for a given amount of time (seconds).
Parameters
void
Simulates current emmitter for a given amount of time (seconds).
Parameters
time : number — Time in secounds
Returnsvoid
resetState() method
Sets the internal state to
Sets the internal state to
EmitterState.PENDING
. Use this when you need to restart emitting.
add(modifiers) method
A helper method for quick adding modifiers.
A helper method for quick adding modifiers.
addModifier(modifier) method
Adds Modifier to the end of the list.
Adds Modifier to the end of the list.
__getTime() method
Hacky method which returns time now or presimulation time depending on a case.
Hacky method which returns time now or presimulation time depending on a case.
Inherited Methods
onRender() inherited method
Called at the end of the loop, all renderers are already collected and this object and its children will be
rendered. Should be used to interpolate between last and current state.
Called at the end of the loop, all renderers are already collected and this object and its children will be
rendered. Should be used to interpolate between last and current state.
getRenderer() inherited method
Factory method returns concrete renderer for this Game Object.
Factory method returns concrete renderer for this Game Object.
onGetLocalBounds(outRect) inherited method
Override this method if you need to specify GameObject size. Should be always be a local coordinates.
Override this method if you need to specify GameObject size. Should be always be a local coordinates.
getBounds(space, includeChildren, outRect) inherited method
Returns world bounds of this object and all children if specified (true by default).
Parameters
Rectangle — Returns bounds of the object with/without all children.
Returns world bounds of this object and all children if specified (true by default).
object.getBounds()
- relative to parent (default).object.getBounds(object)
- local bounds.object.getBounds(object.parent)
- relative to parent.object.getBounds(objectB)
- relative to objectB space.Parameters
space : GameObject — The
includeChildren : boolean — Specifies if include children in calculations.
outRect : Rectangle — Rectangle to be returned.
ReturnsGameObject
relative to. includeChildren : boolean — Specifies if include children in calculations.
outRect : Rectangle — Rectangle to be returned.
Rectangle — Returns bounds of the object with/without all children.
hitTest(localPoint) inherited method
Evaluates whether the game object or one of its children intersects with the given point
Evaluates whether the game object or one of its children intersects with the given point
checkStatic(includeChildren) inherited method
Returns true if object was clean for at least 1 update.
Note: Make sure to apply all changes to this game object before checking for static.
Parameters
boolean
Returns true if object was clean for at least 1 update.
Note: Make sure to apply all changes to this game object before checking for static.
Parameters
includeChildren : boolean
Returnsboolean
onAdded() inherited method
This method called each time object added to stage.
This method called each time object added to stage.
onRemoved() inherited method
Called when object is removed from stage.
Called when object is removed from stage.
addChild(child) inherited method
Adds a child
children in this GameObject instance.
Parameters
GameObject
Adds a child
GameObject
instance to this GameObject
instance. The child is added to the top of all other children in this GameObject instance.
Parameters
child : GameObject — The GameObject instance to add as a child of this GameObject instance.
ReturnsGameObject
addChildAt(child, index) inherited method
Adds a child
children in this GameObject instance.
Parameters
GameObject — The GameObject instance that you pass in the child parameter.
Adds a child
GameObject
instance to this GameObject
instance. The child is added to the top of all other children in this GameObject instance.
Parameters
child : GameObject — The GameObject instance to add as a child of this GameObject instance.
index : number — The index position to which the child is added.
Returnsindex : number — The index position to which the child is added.
GameObject — The GameObject instance that you pass in the child parameter.
setChildIndex(child, index) inherited method
Sets the index (layer) of the specified
Sets the index (layer) of the specified
GameObject
to the specified index (layer).
removeChild(child) inherited method
Removes specified child
Removes specified child
GameObject
instance from children.
getChildByName(name) inherited method
Finds children by name.
Parameters
GameObject | null — GameObject instance or null if not found.
Finds children by name.
Parameters
name : string — Name of the child object to find.
ReturnsGameObject | null — GameObject instance or null if not found.
getChildAt(index) inherited method
Returns
Parameters
GameObject — The `GameObject` at specified index.
Returns
GameObject
at specified index.
Parameters
index : number — The index of child
ReturnsGameObject
. GameObject — The `GameObject` at specified index.
addComponent(component) inherited method
Adds Component instance to the end of the list.
Adds Component instance to the end of the list.
addComponentAt(component, index) inherited method
Adds Component to the list at given position.
Adds Component to the list at given position.
removeComponent(instance) inherited method
Remove specified component.
Remove specified component.
getComponent(typeName) inherited method
Get component by type.
Parameters
Component | null — The `Component` instance or null if not found.
Get component by type.
Parameters
typeName : function — The component type.
ReturnsComponent | null — The `Component` instance or null if not found.
onUpdate() inherited method
Called at every engine update. The execution order of onFixedUpdate, onUpdate and onPostUpdate is
going from top to bottom of the display list.
Called at every engine update. The execution order of onFixedUpdate, onUpdate and onPostUpdate is
going from top to bottom of the display list.
getStageBounds(outRect) inherited method
Returns stage relative bounds of this object excluding it's children;
Returns stage relative bounds of this object excluding it's children;
setTransform(x, y, r, scaleX, scaleY, anchorX, anchorY, includeChildren) inherited method
Sets the object transform in one line.
Parameters
GameObject — This.
Sets the object transform in one line.
Parameters
x : number — Cord X.
y : number — Cord Y.
r : number — Rotation.
scaleX : number — Scale X.
scaleY : number — Scale Y.
anchorX : number — Anchor X.
anchorY : number — Anchor Y.
includeChildren : boolean — Include children when adjusting pivot?
Returnsy : number — Cord Y.
r : number — Rotation.
scaleX : number — Scale X.
scaleY : number — Scale Y.
anchorX : number — Anchor X.
anchorY : number — Anchor Y.
includeChildren : boolean — Include children when adjusting pivot?
GameObject — This.
relativeTo(gameObject, outVector) inherited method
Calculates GameObject's position relative to another GameObject.
Calculates GameObject's position relative to another GameObject.
localToGlobal(localPoint, outVector) inherited method
Calculate global position of the object.
Calculate global position of the object.
globalToLocal(globalPoint, outVector) inherited method
Calculate local position of the object
Calculate local position of the object
alignAnchor(ax, ay) inherited method
Sets the origin point relatively to its bounds. For example, setting x and y value to 0.5 will set origin to the
center of the object.
Parameters
GameObject — This.
Sets the origin point relatively to its bounds. For example, setting x and y value to 0.5 will set origin to the
center of the object.
Parameters
ax : number — Align along x-axis.
ay : number — Align along y-axis.
Returnsay : number — Align along y-axis.
GameObject — This.
alignPivot(ax, ay) inherited method
Sets anchor point to given position. See
Parameters
GameObject — This.
Sets anchor point to given position. See
alignPivotOffset
.
Parameters
ax : number — Align along x-axis.
ay : number — Align along y-axis.
Returnsay : number — Align along y-axis.
GameObject — This.
alignPivotOffset(ax, ay, includeChildren) inherited method
Sets the origin point offset from current anchor value. For example, setting anchor-x value to 0.5 and pivotOffsetX
to 10 will center object by x-axis and will shift object to the left by 10 pixels from half of the width.
Parameters
GameObject — This.
Sets the origin point offset from current anchor value. For example, setting anchor-x value to 0.5 and pivotOffsetX
to 10 will center object by x-axis and will shift object to the left by 10 pixels from half of the width.
Parameters
ax : number — Align along x-axis.
ay : number — Align along y-axis.
includeChildren : boolean — Include children elements when calculating bounds?
Returnsay : number — Align along y-axis.
includeChildren : boolean — Include children elements when calculating bounds?
GameObject — This.
spawn(gen, ctx) inherited method
Starts coroutine.
Parameters
*
Starts coroutine.
Parameters
gen : function — Generator function.
ctx : * — Context for Generator function.
Returnsctx : * — Context for Generator function.
*
wait(seconds) inherited method
Waits for given amount of seconds before processing.
Parameters
function
Waits for given amount of seconds before processing.
Parameters
seconds : number — Duration
Returnsfunction
waitMessage(message) inherited method
Waits for a specific message.
Parameters
function
Waits for a specific message.
Parameters
message : string — The name of the message to wait for.
Returnsfunction
setDirty(flag, includeChildren) inherited method
Marks this GameObject and/or its children elements as dirty.
Parameters
void
Marks this GameObject and/or its children elements as dirty.
Parameters
flag : DirtyFlag — The flag or flag bit mask.
includeChildren : boolean — Specifies if the flag needed for all children.
ReturnsincludeChildren : boolean — Specifies if the flag needed for all children.
void
setParentDirty(flag) inherited method
Marks the GameObject's parent as dirty.
Parameters
void
Marks the GameObject's parent as dirty.
Parameters
flag : DirtyFlag — The flag or flag bit mask.
Returnsvoid
setTransformDirty() inherited method
Marks this GameObject as Local dirty and all children elements as World dirty.
Marks this GameObject as Local dirty and all children elements as World dirty.
setRenderDirty() inherited method
Marks this GameObject with Render dirty flag if it is not suspended for dirty.
Marks this GameObject with Render dirty flag if it is not suspended for dirty.
on(name, callback, context) inherited method
Adds listener by given name and callback.
Parameters
MessageBinding
Adds listener by given name and callback.
Parameters
name : string — Message name.
callback : function — Function to be called on message send.
context : * — Object to be used as
Returnscallback : function — Function to be called on message send.
context : * — Object to be used as
this
in callback function. MessageBinding
off(names) inherited method
Removes all bindings by given message name.
Parameters
void
Removes all bindings by given message name.
Parameters
names : string — One or more message name.
Returnsvoid
once(name, callback, context) inherited method
Adds listener by given name and callback. Binding will be automatically removed after first execution.
Parameters
MessageBinding
Adds listener by given name and callback. Binding will be automatically removed after first execution.
Parameters
name : string — Message name.
callback : function — Function to be called on message send.
context : * — Object to be used as
Returnscallback : function — Function to be called on message send.
context : * — Object to be used as
this
in callback function. MessageBinding
post(name, params) inherited method
Posts message with a given params.
Adding
Parameters
void
Posts message with a given params.
Adding
~
character to the begging of the name will bubble message to the top of the tree.Parameters
name : string — The name of a message
params : * — A list of params to send
Returnsparams : * — A list of params to send
void
Properties
emitCount : FloatScatter property
Gets/Sets the number of particles to be emitted per Emitter.emitInterval
Gets/Sets the number of particles to be emitted per Emitter.emitInterval
emitNumRepeats : FloatScatter property
Gets/Sets the number of "durations" to to repeat. Use
Gets/Sets the number of "durations" to to repeat. Use
Infinity
to emit particles endlessly.
space : GameObject property
Gets/Sets the space where emitting simulation will happen, ignoring space transformation, so all forces are relative to global.
Gets/Sets the space where emitting simulation will happen, ignoring space transformation, so all forces are relative to global.
sortOrder : EmitterSortOrder property
Gets/Sets the order in which particles will be sorted when rendering.
Gets/Sets the order in which particles will be sorted when rendering.
Inherited Properties
color : number inherited property
Gets/Sets tinting color of the object. Pass
objects. You can override tint color for children by setting custom value or
Gets/Sets tinting color of the object. Pass
null
to disable tinting. Tinting color will be applied to all childrenobjects. You can override tint color for children by setting custom value or
null
to inherit color from parent.
cacheAsBitmap : boolean inherited property
Gets/Sets whether this container and all it's children should be baked into bitmap. Setting
Sprites,, TextField's or any other inherited classes will give zero effect.
Gets/Sets whether this container and all it's children should be baked into bitmap. Setting
cacheAsBitmap
ontoSprites,, TextField's or any other inherited classes will give zero effect.
cacheAsBitmapDynamic : boolean inherited property
Gets/sets whenever cache as bitmap should be automatically refreshed.
Gets/sets whenever cache as bitmap should be automatically refreshed.
alpha : number inherited property
Gets/Sets the opacity of the object.
Baked objects may change behavior.
Gets/Sets the opacity of the object.
Baked objects may change behavior.
snapToPixels : boolean inherited property
Gets/sets whenever this object x and y value should be rounded.
Gets/sets whenever this object x and y value should be rounded.
worldTransformation : Matrix inherited property
Gets cloned Matrix object which represents object orientation in world space.
Gets cloned Matrix object which represents object orientation in world space.
worldTransformationInverted : Matrix inherited property
Returns cloned and inverted Matrix object which represents object orientation in world space
Returns cloned and inverted Matrix object which represents object orientation in world space
x : number inherited property
Gets/Sets the x coordinate of the GameObject instance relative to the local coordinates of the parent GameObject.
Gets/Sets the x coordinate of the GameObject instance relative to the local coordinates of the parent GameObject.
y : number inherited property
Gets/Sets the y coordinate of the GameObject instance relative to the local coordinates of the parent GameObject.
Gets/Sets the y coordinate of the GameObject instance relative to the local coordinates of the parent GameObject.
pivotOffsetX : number inherited property
Gets/Sets the x coordinate of the object's origin in its local space in pixels.
Gets/Sets the x coordinate of the object's origin in its local space in pixels.
pivotOffsetY : number inherited property
Gets/Sets the y coordinate of the object's origin in its local space in pixels.
Gets/Sets the y coordinate of the object's origin in its local space in pixels.
scale : number inherited property
Gets/sets both
Gets/sets both
scaleX
and scaleY
. Getter will return scaleX
value;
stage : Stage | null inherited property
Returns the stage Game Object to which this belongs to or null if not added onto stage.
Returns the stage Game Object to which this belongs to or null if not added onto stage.
localWidth : number inherited property
Returns width of this GameObject in local space without including children
elements.
Returns width of this GameObject in local space without including children
elements.
localHeight : number inherited property
Returns height of this GameObject in local space without including children
elements.
Returns height of this GameObject in local space without including children
elements.
path : string | null inherited property
Returns string representing a url like path to this object in the display
tree.
Returns string representing a url like path to this object in the display
tree.