new ParticleEmitter(pos, angle, emitSize, emitTime, emitRate, emitConeAngle, tileInfo, colorStartA, colorStartB, colorEndA, colorEndB, particleTime, sizeStart, sizeEnd, speed, angleSpeed, damping, angleDamping, gravityScale, particleConeAngle, fadeRate, randomness, collideLevel, additive, randomColorLinear, renderOrder, localSpace)engineParticles.js:49Create a particle system with the given settings
posVector2World space position of the emitter
anglenumber optionalAngle to emit the particles
emitSizenumber|Vector2 optional, default 0World space size of the emitter (float for circle diameter, vec2 for rect)
emitTimenumber optional, default 0How long to stay alive (0 is forever)
emitRatenumber optional, default 100How many particles per second to spawn, does not emit if 0
emitConeAnglenumber optional, default PIHalf angle of the cone around the emitter's angle that particles move along, PI is every direction
tileInfoTileInfo optionalTile info to render particles (undefined is untextured)
colorStartAColor optional, default WHITEColor at start of life 1, randomized between start colors
colorStartBColor optional, default WHITEColor at start of life 2, randomized between start colors
colorEndAColor optional, default CLEAR_WHITEColor at end of life 1, randomized between end colors
colorEndBColor optional, default CLEAR_WHITEColor at end of life 2, randomized between end colors
particleTimenumber optional, default 0.5How long particles live
sizeStartnumber optional, default 0.1How big are particles at start
sizeEndnumber optional, default 1How big are particles at end
speednumber optional, default 0.1How fast are particles when spawned, in world units per frame (at 60fps, so multiply units/sec by 1/60)
angleSpeednumber optional, default 0.05How fast are particles rotating, in radians per frame (at 60fps)
dampingnumber optional, default 1How much to dampen particle speed, per-frame velocity multiplier (1 = no damping, .9 = lose 10% speed each frame)
angleDampingnumber optional, default 1How much to dampen particle angular speed, per-frame multiplier (1 = no damping)
gravityScalenumber optional, default 0How much gravity affects particles
particleConeAnglenumber optionalHalf angle each side of the emitter's angle for a particle's start angle, PI is any angle
fadeRatenumber optional, default 0.1Fraction of life spent fading: half at fade-in (start), half at fade-out (end). e.g. .2 = 10% fade-in, 80% full opacity, 10% fade-out
randomnessnumber optional, default 0.2Apply extra randomness percent
collideLevelboolean optional, default falseDo particles collide with the level's tiles, world space emitters only
additiveboolean optional, default falseShould particles use additive blend
randomColorLinearboolean optional, default trueShould color be randomized linearly or across each component
renderOrdernumber optionalRender order for particles (additive is above other stuff by default)
localSpaceboolean optional, default falseShould it be in local space of emitter (world space is default)
// create a particle emitter
let pos = vec2(2,3);
let particleEmitter = new ParticleEmitter
(
pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emitConeAngle
tile(0, 16), // tileInfo
rgb(1,1,1,1), rgb(0,0,0,1), // colorStartA, colorStartB
rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
1, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, speed, angleSpeed
.99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleConeAngle, fadeRate
.5, true // randomness, collideLevel
);