Particles. Particle

Particle Object - Created automatically by Particle Emitters

Constructor

new Particle(emitter, pos, angle, colorStart, colorEnd, lifeTime, sizeStart, sizeEnd, velocityopt, angleVelocityopt)

Create a particle with the passed in settings Typically this is created automatically by a ParticleEmitter

Parameters:
NameTypeAttributesDefaultDescription
emitterParticleEmitter

The emitter that created this particle

posVector2

World or local space position

anglenumber

Angle of the particle

colorStartColor

Color at start of life

colorEndColor

Color at end of life

lifeTimenumber

How long to live for

sizeStartnumber

Size at start of life

sizeEndnumber

Size at end of life

velocityVector2<optional>

Velocity of the particle

angleVelocitynumber<optional>
0

Angular speed of the particle

Members

angle

Properties
TypeDescription
number

Angle in radians

angleVelocity

Properties
TypeDescription
number

Angular speed in radians per frame (at 60fps)

color

Properties
TypeDescription
Color

Current color, updated as it renders

colorEnd

Properties
TypeDescription
Color

Color at end of life

colorStart

Properties
TypeDescription
Color

Color at start of life

destroyed

Properties
TypeDescription
boolean

Has this particle been destroyed

emitter

Properties
TypeDescription
ParticleEmitter

The emitter this particle came from

groundObject :EngineObject|undefined

Type:
  • EngineObject | undefined
Properties
TypeDescription
EngineObject | undefined

Tile layer it last landed on, undefined in the air

lifeTime

Properties
TypeDescription
number

How long this particle lives for

mirror

Properties
TypeDescription
boolean

If true the tile is flipped along the x axis

pos

Properties
TypeDescription
Vector2

Position, world space or local to the emitter when localSpace is set

size

Properties
TypeDescription
Vector2

Current size, updated as it renders

sizeEnd

Properties
TypeDescription
number

Size at end of life

sizeStart

Properties
TypeDescription
number

Size at start of life

spawnTime

Properties
TypeDescription
number

Engine time it was made at

tileInfo :TileInfo|undefined

Type:
  • TileInfo | undefined
Properties
TypeDescription
TileInfo | undefined

The emitter's tile, undefined for an untextured one

velocity

Properties
TypeDescription
Vector2

Velocity in world units per frame (at 60fps)

Methods

destroy()

Destroy this particle, once: a second call does nothing

render()

Render the particle, automatically called each frame

update()

Update the particle