class flixel.effects.particles.FlxTypedEmitter<T> extends FlxTypedGroup<FlxSprite>

Available on all platforms

FlxTypedEmitter is a lightweight particle emitter. * It can be used for one-time explosions or for * continuous fx like rain and fire. FlxEmitter * is not optimized or anything; all it does is launch * FlxParticle objects out at set intervals * by setting their positions and velocities accordingly. * It is easy to use and relatively efficient, * relying on FlxGroup's RECYCLE POWERS.

Instance Fields

var acceleration:FlxPoint

Sets the acceleration member of each particle to this value on launch.

var blend:BlendMode

Sets particle's blend mode. null by default. * Warning: expensive on flash target

var bounce:Float

How much each particle should bounce. 1 = full bounce, 0 = no bounce.

var endAlpha:Bounds<Float>

Sets end alpha range (when particle emits)

var endBlue:Bounds<Float>

Sets end blue color component range (when particle emits)

var endGreen:Bounds<Float>

Sets end green color component range (when particle emits)

var endRed:Bounds<Float>

Sets end red color component range (when particle emits)

var endScale:Bounds<Float>

Sets end scale range (when particle dies)

var frequency:Float

How often a particle is emitted (if emitter is started with Explode == false).

var gravity:Float

Sets the acceleration.y member of each particle to this value on launch.

var height:Float

The height of the emitter. Particles can be randomly generated from anywhere within this box.

var lifespan:Float

How long each particle lives once it is emitted. * Set lifespan to 'zero' for particles to live forever.

var maxRotation:Float

The maximum possible angular velocity of a particle. The default value is 360. * NOTE: rotating particles are more expensive to draw than non-rotating ones!

var minRotation:Float

The minimum possible angular velocity of a particle. The default value is -360. * NOTE: rotating particles are more expensive to draw than non-rotating ones!

var on:Bool

Determines whether the emitter is currently emitting particles. * It is totally safe to directly toggle this.

var particleClass:Class<T>

Set your own particle class type here. The custom class must extend FlxParticle. * Default is FlxParticle.

var particleDrag:FlxPoint

The X and Y drag component of particles launched from the emitter.

var rotation:Bounds<Float>

The minimum and maximum possible angular velocity of a particle. The default value is (-360, 360). * NOTE: rotating particles are more expensive to draw than non-rotating ones!

var startAlpha:Bounds<Float>

Sets start alpha range (when particle emits)

var startBlue:Bounds<Float>

Sets start blue color component range (when particle emits)

var startGreen:Bounds<Float>

Sets start green color component range (when particle emits)

var startRed:Bounds<Float>

Sets start red color component range (when particle emits)

var startScale:Bounds<Float>

Sets start scale range (when particle emits)

var width:Float

The width of the emitter. Particles can be randomly generated from anywhere within this box.

var x:Float

The x position of this emitter.

var xPosition:Bounds<Float>

The x position range of the emitter in world space.

var xVelocity:Bounds<Float>

The x velocity range of a particle. * The default value is (-100,-100).

var y:Float

The y position of this emitter.

var yPosition:Bounds<Float>

The y position range of emitter in world space.

var yVelocity:Bounds<Float>

The y velocity range of a particle. * The default value is (100,100).

function new(?X:Float = 0, ?Y:Float = 0, ?Size:Int = 0):Void

Creates a new FlxTypedEmitter object at a specific position. * Does NOT automatically generate or attach particles! * *

X

The X position of the emitter. *

Y

The Y position of the emitter. *

Size

Optional, specifies a maximum capacity for this emitter.

function at(Object:FlxObject):Void

Change the emitter's midpoint to match the midpoint of a FlxObject. * *

Object

The FlxObject that you want to sync up with.

function destroy():Void

Clean up memory.

function emitParticle():Void

This function can be used both internally and externally to emit the next particle.

function kill():Void

Call this function to turn off all the particles and the emitter.

function makeParticles(Graphics:Dynamic, ?Quantity:Int = 50, ?bakedRotationAngles:Int = 16, ?Multiple:Bool = false, ?Collide:Float = 0.8f, ?AutoBuffer:Bool = false):FlxTypedEmitter<T>

This function generates a new array of particle sprites to attach to the emitter. * *

Graphics

If you opted to not pre-configure an array of FlxParticle objects, you can simply pass in a particle image or sprite sheet. *

Quantity

The number of particles to generate when using the "create from image" option. *

BakedRotations

How many frames of baked rotation to use (boosts performance). Set to zero to not use baked rotations. *

Multiple

Whether the image in the Graphics param is a single particle or a bunch of particles (if it's a bunch, they need to be square!). *

Collide

Whether the particles should be flagged as not 'dead' (non-colliding particles are higher performance). 0 means no collisions, 0-1 controls scale of particle's bounding box. *

AutoBuffer

Whether to automatically increase the image size to accomodate rotated corners. Default is false. Will create frames that are 150% larger on each axis than the original frame or graphic. *

returns

This FlxEmitter instance (nice for chaining stuff together, if you're into that).

function setAlpha(?StartMin:Float = 1, ?StartMax:Float = 1, ?EndMin:Float = 1, ?EndMax:Float = 1):Void

A more compact way of setting the alpha constraints of the emitter. * *

StartMin

The minimum value for particle alpha at the start (emission). *

StartMax

The maximum value for particle alpha at the start (emission). *

EndMin

The minimum value for particle alpha at the end (death). *

EndMax

The maximum value for particle alpha at the end (death).

function setColor(?Start:Int = 16777215, ?End:Int = 16777215):Void

A more compact way of setting the color constraints of the emitter. * But it's not so flexible as setting values of each color bounds objects. * *

Start

The start particles color at the start (emission). *

EndMin

The end particles color at the end (death).

function setPosition(?X:Float = 0, ?Y:Float = 0):Void

Helper function to set the coordinates of this object. * Handy since it only requires one line of code. * *

X

The new x position *

Y

The new y position

function setRotation(?Min:Float = 0, ?Max:Float = 0):Void

A more compact way of setting the angular velocity constraints of the emitter. * *

Min

The minimum value for this range. *

Max

The maximum value for this range.

function setScale(?StartMin:Float = 1, ?StartMax:Float = 1, ?EndMin:Float = 1, ?EndMax:Float = 1):Void

A more compact way of setting the scale constraints of the emitter. * *

StartMin

The minimum value for particle scale at the start (emission). *

StartMax

The maximum value for particle scale at the start (emission). *

EndMin

The minimum value for particle scale at the end (death). *

EndMax

The maximum value for particle scale at the end (death).

function setSize(Width:Int, Height:Int):Void

A more compact way of setting the width and height of the emitter. * *

Width

The desired width of the emitter (particles are spawned randomly within these dimensions). *

Height

The desired height of the emitter.

function setXSpeed(?Min:Float = 0, ?Max:Float = 0):Void

A more compact way of setting the X velocity range of the emitter. * *

Min

The minimum value for this range. *

Max

The maximum value for this range.

function setYSpeed(?Min:Float = 0, ?Max:Float = 0):Void

A more compact way of setting the Y velocity range of the emitter. * *

Min

The minimum value for this range. *

Max

The maximum value for this range.

function start(?Explode:Bool = true, ?Lifespan:Float = 0, ?Frequency:Float = 0.1f, ?Quantity:Int = 0, ?LifespanRange:Float = 0):Void

Call this function to start emitting particles. *

Explode

Whether the particles should all burst out at once. *

Lifespan

How long each particle lives once emitted. 0 = forever. *

Frequency

Ignored if Explode is set to true. Frequency is how often to emit a particle. 0 = never emit, 0.1 = 1 particle every 0.1 seconds, 5 = 1 particle every 5 seconds. *

Quantity

How many particles to launch. 0 = "all of the particles". *

LifespanRange

Max amount to add to the particle's lifespan. Leave it to default (zero), if you want to make particle "live" forever (plus you should set Lifespan parameter to zero too).

function update():Void

Called automatically by the game loop, decides when to launch particles and when to "die".