EmittersEmitters create particles. They can either create a continuous stream of particles or can burst out a number of particles when using the appropriate function. A particle system can have an arbitrary number of emitters. An emitter has the following properties:
- xmin, xmax, ymin, ymax indicate the extent of the region in which the particles are generated.
- shape indicates the shape of the region. It can have the following values:
- distribution indicates the distribution used to generate the particles. It can have the following values:
- ps_distr_linear indicates a linear distribution, that is everywhere in the region the chance is equal
- ps_distr_gaussian indicates a Gaussian distribution in which more particles are generated in the center than at the sides of the region
- ps_distr_invgaussian indicates an inverse Gaussian distribution in which more particles are generated at the sides of the region than in the center
- particle type indicates the type of particles being generated
- number indicates the number of particles generated in each step. If smaller than 0, in each step a particle is generated with a chance -1/number. So for example with a value of -5 a particle is generated on average once every 5 steps.
The following functions are available to set the emitters and to let them create particles. Note that each of them gets the index of the particle system to which it belongs as a first argument.
part_emitter_create(ps) Creates a new emitter in the given particle system. It returns the index of the emitter. This index must be used in all calls below to set the properties of the emitter.
part_emitter_destroy(ps,ind) Destroys emitter ind in the particle system. Call this if you don't need it anymore to save space.
part_emitter_destroy_all(ps) Destroys all emitters in the particle system that have been created.
part_emitter_exists(ps,ind) Returns whether the indicated emitter exists in the particle system.
part_emitter_clear(ps,ind) Clears the emitter ind to its default settings.
part_emitter_region(ps,ind,xmin,xmax,ymin,ymax,shape,distribution) Sets the region and distribution for the emitter.
part_emitter_burst(ps,ind,parttype,number) Bursts once number particles of the indicated type from the emitter.
part_emitter_stream(ps,ind,parttype,number) From this moment on create number particles of the indicated type from the emitter in every step. If you indicate a number smaller than 0 in each step a particle is generated with a chance of -1/number. So for example with a value of -5 a particle is generated on average once every 5 steps.