Constructor
# new ParticleEmitter(position, emitSizeopt, emitTimeopt, emitRateopt, emitConeAngleopt, tileIndexopt, tileSizeopt, colorStartAopt, colorStartBopt, colorEndAopt, colorEndBopt, particleTimeopt, sizeStartopt, sizeEndopt, speedopt, angleSpeedopt, dampingopt, angleDampingopt, gravityScaleopt, particleConeAngleopt, fadeRateopt, randomnessopt, collideTilesopt, additiveopt, randomColorLinearopt, renderOrderopt)
Create a particle system with the given settings
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
position |
Vector2 | World space position of the emitter | ||
emitSize |
Number |
<optional> |
0 | World space size of the emitter (float for circle diameter, vec2 for rect) |
emitTime |
Number |
<optional> |
0 | How long to stay alive (0 is forever) |
emitRate |
Number |
<optional> |
100 | How many particles per second to spawn |
emitConeAngle |
Number |
<optional> |
PI | Local angle to apply velocity to particles from emitter |
tileIndex |
Number |
<optional> |
-1 | Index into tile sheet, if <0 no texture is applied |
tileSize |
Number |
<optional> |
defaultTileSize | Tile size for particles |
colorStartA |
Color |
<optional> |
new Color(1,1,1) | Color at start of life 1, randomized between start colors |
colorStartB |
Color |
<optional> |
new Color(1,1,1) | Color at start of life 2, randomized between start colors |
colorEndA |
Color |
<optional> |
new Color(1,1,1,0) | Color at end of life 1, randomized between end colors |
colorEndB |
Color |
<optional> |
new Color(1,1,1,0) | Color at end of life 2, randomized between end colors |
particleTime |
Number |
<optional> |
.5 | How long particles live |
sizeStart |
Number |
<optional> |
.1 | How big are particles at start |
sizeEnd |
Number |
<optional> |
1 | How big are particles at end |
speed |
Number |
<optional> |
.1 | How fast are particles when spawned |
angleSpeed |
Number |
<optional> |
.05 | How fast are particles rotating |
damping |
Number |
<optional> |
1 | How much to dampen particle speed |
angleDamping |
Number |
<optional> |
1 | How much to dampen particle angular speed |
gravityScale |
Number |
<optional> |
0 | How much does gravity effect particles |
particleConeAngle |
Number |
<optional> |
PI | Cone for start particle angle |
fadeRate |
Number |
<optional> |
.1 | How quick to fade in particles at start/end in percent of life |
randomness |
Number |
<optional> |
.2 | Apply extra randomness percent |
collideTiles |
Boolean |
<optional> |
0 | Do particles collide against tiles |
additive |
Boolean |
<optional> |
0 | Should particles use addtive blend |
randomColorLinear |
Boolean |
<optional> |
0 | Should color be randomized linearly or across each component |
renderOrder |
Number |
<optional> |
0 | Render order for particles (additive is above other stuff by default) |
- Source:
Methods
# emitParticle() → {Particle}
Spawn one particle
- Source:
Returns:
- Type
- Particle
# update()
Update the emitter to spawn particles, called automatically by engine once each frame
- Source: