part_particles_burst

This function creates a single burst of all the particles contained in the given Particle System Asset. The particles are created in the given particle system instance ind.

The function gives you a quick way to add a particle effect that you made in The Particle System Editor to an existing particle system.

This is as if you'd add the emitters inside that particle system asset to the given particle system and then call part_emitter_burst on all of them.

NOTE Particles won't be created for any disabled emitters in the Particle System Asset (which is Enabled unchecked).

 

Syntax:

part_particles_burst(ind, x, y, partsys);

ArgumentTypeDescription
indParticle System InstanceThe index of the particle system in which to create the particles
xRealThe x position to burst the particles
yRealThe y position to burst the particles
partsysParticle System AssetThe particle system asset of which to burst particles

 

Returns:

N/A

 

Example 1:

Create Event

ps = part_system_create_layer("Effects", false);

repeat(10)
{
    var _x = random(room_width);
    var _Y = random(room_height);
    part_particles_burst(ps, _x, _y, ps_Fireworks);
}

The code above first creates a new particle system on a room layer named "Effects" and stores the index in an instance variable ps. The part_particles_burst function is then called 10 times in a repeat loop to add particles from a Particle System Asset ps_Fireworks to the particle system ps.

 

Example 2:

Create Event

ps = part_system_create_layer("Effects", false);

layer_script_begin("Effects", method({ps}, function()
{
    part_particles_burst(ps, random(room_width), random(room_height), ps_Fireworks);
}));

The code above also creates a new particle system on a room layer named "Effects". It then sets a method as the layer begin script. The method gets the particle system ID ps via the struct. Inside it, the function part_particles_burst is used to create particles of the ps_Fireworks Particle System Asset at random positions in the room. This way, particles are created continuously, since the layer begin scripts run every step. The layer begin script can be removed to end the creation of particles from the asset.