API Docs for: 1.13.1
Show:

game.Emitter Class

Extends game.Class
Module: particle

Particle emitter.

Constructor

game.Emitter

(
  • [settings]
)

Parameters:

  • [settings] Object optional

Methods

addParticle

()

Add particle to emitter.

addTo

(
  • container
)

Add emitter to container.

Parameters:

emit

(
  • count
)

Emit particles to emitter.

Parameters:

  • count Number

getVariance

() Number

Get value with variance. Example: if you have value 100 with variance of 50, you will get value between 50 to 150.

Returns:

Number:

remove

()

Remove emitter from scene.

removeParticle

()

Remove particle from emitter.

reset

(
  • resetVec
)

Reset emitter values to defaults.

Parameters:

  • resetVec Boolean

    Reset vector values.

update

()

Update particles.

updateParticle

()

Update particle.

Properties

accelAngle

Number

Acceleration angle in radians.

Default: Math.PI / 2

accelAngleVar

Number

Default: 0

accelSpeed

Number

Acceleration speed.

Default: 0

accelSpeedVar

Number

Default: 0

active

Boolean

Is emitter active.

Default: true

angle

Number

Emit angle in radians.

Default: 0

angleVar

Number

Variance of emit angle in radians.

Default: 0

container

game.Container

Container for particle sprites.

count

Number

Emit count of particles.

Default: 10

duration

Number

Emitter duration in ms (0 is forever).

Default: 0

endAlpha

Number

End alpha for particle.

Default: 0

endScale

Number

Default: 1

endScaleVar

Number

Default: 0

life

Number

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

Default: 2000

lifeVar

Number

Particle's life variance.

Default: 0

particles

Array

poolName

String

Pool name for particles.

Default: emitter

positionVar

game.Point

rate

Number

How often to emit new particles in ms.

Default: 100

rotate

Number

Particle's sprite rotation speed.

Default: 0

rotateVar

Number

Variance for particle's sprite rotation speed.

Default: 0

speed

Number

Particle's initial speed.

Default: 100

speedVar

Number

Variance for particle's initial speed.

Default: 0

spriteSettings

Object

Settings to apply on particle sprite.

startAlpha

Number

Starting alpha for particle.

Default: 1

startScale

Number

Starting scale for particle.

Default: 1

startScaleVar

Number

Default: 0

target

game.Point

Target position for particles.

targetForce

Number

Target positions force.

Default: 0

textures

Array

List of texture paths.

velocityLimit

game.Point

Default: 0

velRotate

Number

Particle's velocity rotation speed.

Default: 0

velRotateVar

Number

Variance for particle's velocity rotation speed.

Default: 0