Particles (Extends from FastContainer)

Module: engine.particle

Particle emitter, that emits particles using Particle class.

new game.Particles(textures, [options])

Parameters:

  • textures String|Array

    Name of texture or array of texture names.

  • options Object (optional)

Properties

_cached Boolean (Default: false)

(No description yet)

_cachedSprite Sprite

(No description yet)

_cosCache Number (Default: 1)

(No description yet)

_currentTexture Number

(No description yet)

_durationTimer Number

(No description yet)

_interactive Boolean (Default: false)

(No description yet)

_isRotated Boolean

(No description yet)

_lastTransformUpdate Number

(No description yet)

_localTransform Matrix

(No description yet)

_onCompleteCalled Boolean

(No description yet)

_parent Container

(No description yet)

_rateTimer Number

(No description yet)

_rotationCache Number (Default: 0)

(No description yet)

_sinCache Number (Default: 0)

(No description yet)

_worldAlpha Number (Default: 1)

(No description yet)

_worldBounds Rectangle

(No description yet)

_worldTransform Matrix

(No description yet)

accelAngle Number (Default: Math.PI / 2)

Acceleration angle in radians.

accelAngleVar Number (Default: 0)

(No description yet)

accelSpeed Number (Default: 0)

Acceleration speed.

accelSpeedVar Number (Default: 0)

(No description yet)

active Boolean (Default: true)

Is emitter active.

alpha Number (Default: 1)

Container opacity, 0 makes it invisible.

alphaEnd Number (Default: 0)

End alpha for particle.

alphaStart Number (Default: 1)

Starting alpha for particle.

anchor Vector

(No description yet)

angle Number (Default: 0)

Emit angle in radians (0 is right).

angleVar Number (Default: Math.PI)

Variance of emit angle in radians.

buttonMode Boolean (Default: false)

Change cursor, when mouse is over the container. Define cursor at game.Input.buttonModeCursor.

cache Boolean (Default: false)

Cache container content as bitmap.

children Array

(No description yet)

emitCount Number (Default: 1)

How many particles to emit.

emitDuration Number (Default: 0)

How long to emit particles in milliseconds (0 is forever).

emitRate Number (Default: 100)

How often to emit particles in milliseconds.

height Number

(No description yet)

hitArea Rectangle|Circle

(No description yet)

interactive Boolean (Default: false)

(No description yet)

life Number (Default: 2000)

Particle's life in ms (0 is forever).

lifeVar Number (Default: 0)

Particle's life variance.

mask Graphics

(No description yet)

onComplete Function

(No description yet)

parent Container

(No description yet)

particles Array

List of particles.

poolName String

(No description yet)

position Vector

(No description yet)

randomTexture Boolean

Use random texture from textures list.

renderable Boolean (Default: true)

(No description yet)

rotate Number (Default: 0)

Particle's sprite rotation speed.

rotateVar Number (Default: 0)

Variance for particle's sprite rotation speed.

rotation Number (Default: 0)

(No description yet)

scale Vector

(No description yet)

scaleEnd Number (Default: 1)

(No description yet)

scaleEndVar Number (Default: 0)

(No description yet)

scaleStart Number (Default: 1)

Starting scale for particle.

scaleStartVar Number (Default: 0)

(No description yet)

skew Vector

(No description yet)

speed Number (Default: 100)

Particle's initial speed.

speedVar Number (Default: 0)

Variance for particle's initial speed.

stage Container

(No description yet)

startPos Vector

Particle start position.

startPosVar Vector

Particle start position variance.

startRot Number

Particle start rotation.

startRotVar Number

Particle start rotation variance.

target Vector

Target position for particles.

targetForce Number (Default: 0)

Target positions force.

targetUpdate Boolean (Default: true)

Update target position to all particles every frame. If this is false and you change target, it will affect only particles created after the change.

textures Array

List of textures.

velocityLimit Vector (Default: 0,0)

(No description yet)

velRotate Number (Default: 0)

Particle's velocity rotation speed.

velRotateVar Number (Default: 0)

Variance for particle's velocity rotation speed.

visible Boolean (Default: true)

Visibility. If set to false, rendering and interactivity will be disabled.

width Number

(No description yet)

x Number

Shorthand for position.x

y Number

Shorthand for position.y

Methods

_addParticle()

(No description yet)

_destroyCachedSprite()

(No description yet)

_generateCachedSprite()

(No description yet)

_getBounds() Rectangle

(No description yet)

_worldBounds

_getVar(value) Number

(No description yet)

Parameters:

  • value Number
_removeParticle(particle)

Remove particle from emitter.

Parameters:

  • particle Particle
_removeStageReference()

(No description yet)

_render(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderBatch(child, context)

(No description yet)

Parameters:

  • child Sprite
  • context CanvasRenderingContext2D
_renderCanvas(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_renderChildren(context)

(No description yet)

Parameters:

  • context CanvasRenderingContext2D
_setStageReference(stage)

(No description yet)

Parameters:

  • stage Container
_updateChildTransform()

(No description yet)

_updateParentTransform()

(No description yet)

addChild(child)

(No description yet)

Parameters:

  • child Container
addChildAt(child, index)

(No description yet)

Parameters:

  • child Container
  • index Number
addTo(container, [index])

Add this to container.

Parameters:

  • container Container
  • index Number (optional)
anchorCenter()

(No description yet)

center(target, [offsetX], [offsetY], [worldPos])

Position container to center of target.

Parameters:

  • target Container
  • offsetX Number (optional)
  • offsetY Number (optional)
  • worldPos Boolean (optional)

    Use world position.

click(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
emit([count])

Emit particles.

Parameters:

  • count Number (optional)
hitTest(target) Boolean

Test if container's bounds are overlapping target's bounds.

Parameters:

  • target Container
mousedown(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent

Return true, to skip to next object.

mousemove(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent

Return true, to skip to next object.

mouseout(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
mouseover(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
mouseup(x, y, id, event) Boolean

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent

Return true, to skip to next object.

mouseupoutside(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event MouseEvent|TouchEvent
onScreen() Boolean

Check if container is on the screen.

Return true, if on the screen.

remove()

Remove this from it's parent.

removeAll()

Remove all childrens.

removeChild(child)

Remove children.

Parameters:

  • child Container
reset()

Reset emitter timer.

swap(container)

Swap container position with this container.

Parameters:

  • container Container
swapChildren(child, child2)

Swap position of two childrens.

Parameters:

  • child Container
  • child2 Container
toBottom()

Move container to first children.

toTop()

Move container to last children.

toWorldPosition([vector], [local]) Vector

Get current world position

Parameters:

  • vector Vector (optional)

    Vector to set world position

  • local Boolean (optional)

    Convert world position to local position

Returns new Vector, if vector parameter not defined

updateTransform()

(No description yet)

Attributes

poolName String (Default: particle)

(No description yet)