Class Emitter extends DisplayObject

Particle emitter.

Methods

Emitter() constructor
Creates new Emitter instance.
resetState() method
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.

Parameters
modifiers : GameObject | Component | Modifier — The list of modifiers.
Returns
Emitter
addModifier(modifier) method

Adds Modifier to the end of the list.

Parameters
modifier : Modifier — Modifier to add.
Returns
Modifier

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.
getRenderer() inherited method
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.

Parameters
outRect : Rectangle — Rectangle to be returned.
Returns
Rectangle — bounds in local space without taking care about transformation matrix
getBounds(space, includeChildren, outRect) inherited method

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 GameObject relative to.
includeChildren : boolean — Specifies if include children in calculations.
outRect : Rectangle — Rectangle to be returned.
Returns
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

Parameters
localPoint : Vector — Coordinates vector.
Returns
GameObject | null
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
includeChildren : boolean
Returns
boolean
onAdded() inherited method
This method called each time object added to stage.
onRemoved() inherited method
Called when object is removed from stage.
addChild(child) inherited method

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.
Returns
GameObject
addChildAt(child, index) inherited method

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.
Returns
GameObject — The GameObject instance that you pass in the child parameter.
setChildIndex(child, index) inherited method

Sets the index (layer) of the specified GameObject to the specified index (layer).

Parameters
child : GameObject — The GameObject instance to change index for.
index : number — Desired index.
Returns
GameObject — The `GameObject` instance that you pass in the child parameter.
removeFromParent() inherited method
Removes this GameObject instance from its parent.
removeChild(child) inherited method

Removes specified child GameObject instance from children.

Parameters
child : GameObjectGameObject instance to remove.
Returns
GameObject — The `GameObject` instance that you pass in the child parameter.
getChildByName(name) inherited method

Finds children by name.

Parameters
name : string — Name of the child object to find.
Returns
GameObject | null — GameObject instance or null if not found.
removeChildAt(index) inherited method

Removes GameObjects instance from specified index.

Parameters
index : number — Index of child.
Returns
GameObject — The removed `GameObject` instance.
getChildAt(index) inherited method

Returns GameObject at specified index.

Parameters
index : number — The index of child GameObject.
Returns
GameObject — The `GameObject` at specified index.
addComponent(component) inherited method

Adds Component instance to the end of the list.

Parameters
component : ComponentComponent instance or instances.
Returns
Component — The `Component` instance you pass in the instances parameter.
removeComponent(instance) inherited method

Remove specified component.

Parameters
instance : Component — The Component instance.
Returns
Component | null
getComponent(typeName) inherited method

Get component by type.

Parameters
typeName : function — The component type.
Returns
Component | null — The `Component` instance or null if not found.
getComponentAt(index) inherited method

Retrieves Component at given index.

Parameters
index : number — Index of component.
Returns
Component | null
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.
onCollectRenderables(driver, parentRenderer, isBackBufferActive) inherited method

Called every time GameObject has to be rendered. Doesn't render itself. Collects render data to be processed by
video driver after.

NOTE: Adding, removing or changing children elements inside onRender method can lead to unexpected behavior.

Parameters
driver : VideoNullDriver — Current registered video driver.
parentRenderer : Renderer — Renderer of parent GameObject if there is one.
isBackBufferActive : boolean — Specifies if render to backBuffer.
Returns
Renderer
getStageBounds(outRect) inherited method

Returns stage relative bounds of this object excluding it's children;

Parameters
outRect : Rectangle — Rectangle to be store resulting bounds in.
Returns
Rectangle
setTransform(x, y, r, scaleX, scaleY, anchorX, anchorY, includeChildren) inherited method

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?
Returns
GameObject — This.
relativeTo(gameObject, outVector) inherited method

Calculates GameObject's position relative to another GameObject.

Parameters
gameObject : GameObject — Coordinates vector.
outVector : Vector | null — Vector to be returned.
Returns
Vector
localToGlobal(localPoint, outVector) inherited method

Calculate global position of the object.

Parameters
localPoint : Vector — Coordinates vector.
outVector : Vector | null — Vector to be returned.
Returns
Vector
globalToLocal(globalPoint, outVector) inherited method

Calculate local position of the object

Parameters
globalPoint : Vector — Coordinates vector.
outVector : Vector | null — Vector to be returned.
Returns
Vector
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
ax : number — Align along x-axis.
ay : number — Align along y-axis.
Returns
GameObject — This.
alignPivot(ax, ay) inherited method

Sets anchor point to given position. See alignPivotOffset.

Parameters
ax : number — Align along x-axis.
ay : number — Align along y-axis.
Returns
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
ax : number — Align along x-axis.
ay : number — Align along y-axis.
includeChildren : boolean — Include children elements when calculating bounds?
Returns
GameObject — This.
spawn(gen, ctx) inherited method

Starts coroutine.

Parameters
gen : function — Generator function.
ctx : * — Context for Generator function.
Returns
*
wait(seconds) inherited method

Waits for given amount of seconds before processing.

Parameters
seconds : number — Duration
Returns
function
waitMessage(message) inherited method

Waits for a specific message.

Parameters
message : string — The name of the message to wait for.
Returns
function
setDirty(flag, includeChildren) inherited method

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.
Returns
void
setParentDirty(flag) inherited method

Marks the GameObject's parent as dirty.

Parameters
flag : DirtyFlag — The flag or flag bit mask.
Returns
void
setTransformDirty() inherited method
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.
on(name, callback, context) inherited method

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 this in callback function.
Returns
MessageBinding
off(names) inherited method

Removes all bindings by given message name.

Parameters
names : string — One or more message name.
Returns
void
once(name, callback, context) inherited method

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 this in callback function.
Returns
MessageBinding
post(name, params) inherited method

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
Returns
void

Properties

state : EmitterState property
Gets current emitter state.
maxParticles : number property
Gets/Sets The maximum number of particles can be created.
emitCount : FloatScatter property
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 Infinity to emit particles endlessly.
emitDuration : FloatScatter property
Gets/Sets
emitInterval : FloatScatter property
Gets/Sets
emitDelay : FloatScatter property
Gets/Sets
space : GameObject property
Gets/Sets the space where emitting simulation will happen, ignoring space transformation, so all forces are relative to global.
textures : Array. property
Gets/Sets a list of textures to use.
texturesName : void property
Sets the list of textures with given string. It uses AssetManager to find textures. Wildcard supported.
sortOrder : EmitterSortOrder property
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 null to disable tinting. Tinting color will be applied to all children
objects. 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 cacheAsBitmap onto
Sprites,, 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.
alpha : number inherited property
Gets/Sets the opacity of the object.
Baked objects may change behavior.
visible : boolean inherited property
Gets/Sets visibility of the object.
blendMode : BlendMode inherited property
Gets/Sets blend mode for the object.
clipRect : Rectangle inherited property
Gets/Sets clipping area for the object.
snapToPixels : boolean inherited property
Gets/sets whenever this object x and y value should be rounded.
id : number inherited property
Returns unique object id.
numComponents : number inherited property
Returns number of component's of this GameObject.
localTransformation : Matrix inherited property
Returns local transformation Matrix
worldTransformation : Matrix inherited property
Gets/Sets 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
localBounds inherited property
Returns local bounds of this object (without children).
bounds inherited property
Returns parent-relative bounds (including children).
numChildren : number inherited property
Gets a count of children elements.
name : string | null inherited property
Gets/Sets the name of this GameObject instance.
x : number inherited property
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.
pivotOffsetX : number inherited property
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.
pivotX : number inherited property
Returns current pivot-x value in range from 0 to 1.
pivotY : number inherited property
Returns current pivot-y value in range from 0 to 1.
scaleX : number inherited property
Gets/Sets the scale factor of this object along x-axis.
scaleY : number inherited property
Gets/Sets the scale factor of this object along y-axis.
scale : number inherited property
Gets/sets both scaleX and scaleY. Getter will return scaleX value;
skewX : number inherited property
Gets/sets horizontal skew angle in radians.
skewY : number inherited property
Gets/sets vertical skew angle in radians.
rotation : number inherited property
Gets/Sets rotation in radians.
parent : GameObject | null inherited property
Returns this GameObject parent GameObject or null.
root : GameObject inherited property
Returns top most parent object or this if there is no parents.
stage : Stage | null inherited property
Returns the stage Game Object to which this belongs to or null if not added onto stage.
width : number inherited property
Gets/sets the width of this object.
height : number inherited property
Gets/sets the height of this object.
localWidth : number inherited property
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.
path : string | null inherited property
Returns string representing a url like path to this object in the display
tree.
tag : string | null inherited property
Gets/Sets tag of this GameObject.