part_emitter_enable

This function enables or disables the given particle emitter.

Usage Notes

 

Syntax:

part_emitter_enable(ps, ind, enable);

ArgumentTypeDescription
psParticle System InstanceThe index of the particle system the emitter's in
indParticle Emitter IDThe index of the emitter to change
enableBooleanWhether to enable the emitter or not

 

Returns:

N/A

 

Example:

 

Create Event

ps = part_system_create();

pe1 = part_emitter_create(ps);
part_emitter_region(ps, pe1, 100, 200, 100, 200, ps_shape_rectangle, ps_distr_gaussian);
part_emitter_enable(ps, pe1, false);
pe2 = part_emitter_create(ps);
part_emitter_region(ps, pe2, 200, 300, 100, 200, ps_shape_rectangle, ps_distr_gaussian);

pt = part_type_create();
part_type_speed(pt, 2, 2, 0, 0);
part_type_direction(pt, 90, 90, 0, .2);

part_emitter_stream(ps, pe1, pt, 2);
part_emitter_stream(ps, pe2, pt, 2);

Cleanup Event

part_emitter_destroy(ps, pe1);
part_emitter_destroy(ps, pe2);
part_system_destroy(ps);
part_type_destroy(pt);

The above code creates a particle system ps in the Create event and adds two emitters to it: pe1 and pe2. The emitters are each configured to emit particles in a rectangular region of 100x100 pixels, using a gaussian distribution (i.e. more particles in the center). Emitter pe1 is set to disabled using part_emitter_enable

The two emitters are then "turned on" using part_emitter_stream: each of them is configured to create two particles per step. Since pe1 was set to disabled, it will not emit any particles. pe2 is enabled and emits particles normally.

Finally, since they're dynamic resources, the particle emitters, the system and the type are all destroyed in the Cleanup event.