Class: Particle

Phaser.GameObjects.Particles. Particle

A Particle is a simple Game Object controlled by a Particle Emitter and Manager, and rendered by the Manager. It uses its own lightweight physics system, and can interact only with its Emitter's bounds and zones.


new Particle(emitter)

Parameters:
Name Type Description
emitter Phaser.GameObjects.Particles.ParticleEmitter

The Emitter to which this Particle belongs.

Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 11)

Members


accelerationX :number

The x acceleration of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 90)

accelerationY :number

The y acceleration of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 100)

alpha :number

The alpha value of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 1
Source: src/gameobjects/particles/Particle.js (Line 160)

angle :number

The angle of this Particle in degrees.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 170)

bounce :number

The bounciness, or restitution, of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 130)

data :object

The data used by the ease equation.

Type:
  • object
Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 240)

delayCurrent :number

The delay applied to this Particle upon emission, in ms.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 220)

emitter :Phaser.GameObjects.Particles.ParticleEmitter

The Emitter to which this Particle belongs.

A Particle can only belong to a single Emitter and is created, updated and destroyed via it.

Type:
Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 29)

frame :Phaser.Textures.Frame

The texture frame used to render this Particle.

Type:
Since: 3.0.0
Default Value:
  • null
Source: src/gameobjects/particles/Particle.js (Line 40)

life :number

The lifespan of this Particle in ms.

Type:
  • number
Since: 3.0.0
Default Value:
  • 1000
Source: src/gameobjects/particles/Particle.js (Line 200)

lifeCurrent :number

The current life of this Particle in ms.

Type:
  • number
Since: 3.0.0
Default Value:
  • 1000
Source: src/gameobjects/particles/Particle.js (Line 210)

lifeT :number

The normalized lifespan T value, where 0 is the start and 1 is the end.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 230)

maxVelocityX :number

The maximum horizontal velocity this Particle can travel at.

Type:
  • number
Since: 3.0.0
Default Value:
  • 10000
Source: src/gameobjects/particles/Particle.js (Line 110)

maxVelocityY :number

The maximum vertical velocity this Particle can travel at.

Type:
  • number
Since: 3.0.0
Default Value:
  • 10000
Source: src/gameobjects/particles/Particle.js (Line 120)

rotation :number

The angle of this Particle in radians.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 180)

scaleX :number

The horizontal scale of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 1
Source: src/gameobjects/particles/Particle.js (Line 140)

scaleY :number

The vertical scale of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 1
Source: src/gameobjects/particles/Particle.js (Line 150)

tint :integer

The tint applied to this Particle.

Type:
  • integer
Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 190)

velocityX :number

The x velocity of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 70)

velocityY :number

The y velocity of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 80)

x :number

The x coordinate of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 50)

y :number

The y coordinate of this Particle.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/Particle.js (Line 60)

Methods


checkBounds(emitter)

Checks if this Particle is still within the bounds defined by the given Emitter.

If not, and depending on the Emitter collision flags, the Particle may either stop or rebound.

Parameters:
Name Type Description
emitter Phaser.GameObjects.Particles.ParticleEmitter

The Emitter to check the bounds against.

Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 452)

computeVelocity(emitter, delta, step, processors)

An internal method that calculates the velocity of the Particle.

Parameters:
Name Type Description
emitter Phaser.GameObjects.Particles.ParticleEmitter

The Emitter that is updating this Particle.

delta number

The delta time in ms.

step number

The delta value divided by 1000.

processors array

Particle processors (gravity wells).

Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 389)

fire(x, y)

Starts this Particle from the given coordinates.

Parameters:
Name Type Description
x number

The x coordinate to launch this Particle from.

y number

The y coordinate to launch this Particle from.

Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 281)

isAlive()

Checks to see if this Particle is alive and updating.

Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 256)
Returns:

true if this Particle is alive and updating, otherwise false.

Type
boolean

resetPosition()

Resets the position of this particle back to zero.

Since: 3.16.0
Source: src/gameobjects/particles/Particle.js (Line 269)

update(delta, step, processors)

The main update method for this Particle.

Updates its life values, computes the velocity and repositions the Particle.

Parameters:
Name Type Description
delta number

The delta time in ms.

step number

The delta value divided by 1000.

processors array

An optional array of update processors.

Since: 3.0.0
Source: src/gameobjects/particles/Particle.js (Line 490)
Returns:

Returns true if this Particle has now expired and should be removed, otherwise false if still active.

Type
boolean