Emitter Functions - Grisgram/gml-raptor GitHub Wiki

Emitter functions in the ParticleManager

You will recognize in the documentation of the functions below, that there is always an argument name_or_emitter. Each emitter is an instance of an emitter object (see The ParticleEmitter Object) and therefore a unique thing. You can of course have multiple instances of the same emitter (think about torches in a dungeon... It's very likely, that there is not only one single torch enlighting the entire dungeon). That's why you have to give each emitter instance a name to modify it after creating it. For convenience, these functions also take an emitter instance as argument too.
It depends on your game design, whether you store your instance pointers directly in your objects controlling the emitters or if you just keep the names of the emitters (or build them dynamically based on the parent object). The latter approach makes designing your Savegame System a lot easier, as a string can easily be saved and loaded to and from the savegame.

When you have your ParticleManager obtained through PARTSYS or PARTSYS[i], you control your particles with:

stream

/// @function		stream(name_or_emitter, particles_per_frame = 1, particle_name = undefined)
/// @description	start streaming particles at a specified rate
/// @param {string} name_or_emitter	The emitter name you set in the Particle Editor
/// @param {int}    particles_per_frame The number of particles to emit each frame
/// @param {string} particle_name	In the Particle Editor you set a default particle type for an emitter,
///					however, you MAY override this by specifying a different particle type.
///					Normally you will leave this argument at its default.
static stream = function(name_or_emitter, particles_per_frame = 1, particle_name = undefined) {

stream_at

/// @function		stream_at(xpos, ypos, name_or_emitter, particles_per_frame = 1, particle_name = undefined)
/// @description	start streaming particles at a specified rate and at a specified coordinate
///			ATTENTION! This method will move the emitter range to the specified coordinates!
/// @param {real}   xpos		The new x-position of the emitter range
/// @param {real}   ypos		The new y-position of the emitter range
/// @param {string} name_or_emitter	The emitter name you set in the Particle Editor
/// @param {int}    particles_per_frame The number of particles to emit each frame
/// @param {string} particle_name	In the Particle Editor you set a default particle type for your emitter,
///					however, you MAY override this by specifying a different particle type.
///					Normally you will leave this argument at its default.
static stream_at = function(xpos, ypos, name_or_emitter, particles_per_frame = 1, particle_name = undefined) {

stream_stop

/// @function		stream_stop(name_or_emitter)
/// @description	stop streaming particles.
/// @param {string} name_or_emitter	The emitter name you set in the Particle Editor
static stream_stop = function(name_or_emitter) {

burst

/// @function		burst(name_or_emitter, particle_count = 32, particle_name = undefined)
/// @description	One time particle explosion burst
/// @param {string} name_or_emitter	The emitter name you set in the Particle Editor
/// @param {int}    particle_count	The number of particles to emit at once
/// @param {string} particle_name	In the Particle Editor you set a default particle type for your emitter,
///					however, you MAY override this by specifying a different particle type.
///					Normally you will leave this argument at its default.
static burst = function(name_or_emitter, particle_count = 32, particle_name = undefined) {

burst_at

/// @function		burst_at(xpos, ypos, name_or_emitter, particle_count, particle_name)
/// @description	one time particle explosion burst at a specified coordinate
///			ATTENTION! This method will move the emitter range to the specified coordinates!
/// @param {real}   xpos		The new x-position of the emitter range
/// @param {real}   ypos		The new y-position of the emitter range
/// @param {string} name_or_emitter	The emitter name you set in the Particle Editor
/// @param {int}    particle_count	The number of particles to emit at once
/// @param {string} particle_name	In the Particle Editor you set a default particle type for your emitter,
///					however, you MAY override this by specifying a different particle type.
///					Normally you will leave this argument at its default.
static burst_at = function(xpos, ypos, name_or_emitter, particle_count = 32, particle_name = undefined) {

spawn_particles

This function utilizes a special feature from GameMaker. It offers a way to create some particles at a specific location without an emitter. As you normally always have an Emitter at hand, if you created your particles through the Particle Editor, this function is rarely used. You do not need an emitter to use it, but keep in mind, that the "virtual emitter range" for the particles spawned by this function has a range of zero. The will appear exactly at the specified x/y coordinates, without any range or random distribution.

/// @function		spawn_particles(xpos, ypos, particle_count, particle_name)
/// @description	spawn particles at a specified position without an emitter
/// @param {real}   xpos		The x-position to spawn particles at
/// @param {real}   ypos		The y-position to spawn particles at
/// @param {int}    particle_count	The number of particles to emit
/// @param {string} particle_name	The name of the particle type to spawn
static spawn_particles = function(xpos, ypos, particle_count, particle_name) {

Next stop: Emitter Ranges.

⚠️ **GitHub.com Fallback** ⚠️