new ParticleEmitter(x, y, settings)
Particle Emitter Object.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | x-position of the particle emitter |
y |
Number | y-position of the particle emitter |
settings |
object | An object containing the settings for the particle emitter. See |
Example
// Create a basic emitter at position 100, 100
var emitter = new me.ParticleEmitter(100, 100);
// Adjust the emitter properties
emitter.totalParticles = 200;
emitter.minLife = 1000;
emitter.maxLife = 3000;
emitter.z = 10;
// Add the emitter to the game world
me.game.world.addChild(emitter);
// Launch all particles one time and stop, like a explosion
emitter.burstParticles();
// Launch constantly the particles, like a fountain
emitter.streamParticles();
// At the end, remove emitter from the game world
// call this in onDestroyEvent function
me.game.world.removeChild(emitter);
Extends
- Rect
Members
-
static floating :Boolean
-
Floating property for particles, value is forwarded to the particle container
Methods
-
static burstParticles(total)
-
Launch all particles from emitter and stop
Particles example: ExplosionsParameters:
Name Type Description total
Number [optional] number of particles to launch
-
static getRandomPointX() → {Number}
-
returns a random point inside the bounds x axis of this emitter
Returns:
Number -
static getRandomPointY() → {Number}
-
returns a random point inside the bounds y axis of this emitter
Returns:
Number -
static isRunning() → {Boolean}
-
Emitter is of type stream and is launching particles
Returns:
Boolean -Emitter is Stream and is launching particles
-
static reset(settings)
-
Reset the emitter with default values.
Parameters:
Name Type Description settings
Object [optional] object with emitter settings. See
me.ParticleEmitterSettings
-
static stopStream()
-
Stop the emitter from generating new particles (used only if emitter is Stream)
-
static streamParticles(duration)
-
Launch particles from emitter constantly
Particles example: FountainsParameters:
Name Type Description duration
Number [optional] time that the emitter releases particles in ms