part_emitter_region

This function is used to set their position of a particle emitter within the current room. You specify the bounding box of the area within the function and then use any of a series of constants to define the final emitter shape within this bounding box as well as the distribution of particles within the shape. The available constants for distribution shapes are listed below:

Particle Emitter Shape Constant
ConstantDescription
ps_shape_rectangleA rectangular shape that fills the given area.
ps_shape_ellipseAn ellipse, with the width and height defined by the area.
ps_shape_diamondA diamond shape with the points at half width and half height.
ps_shape_lineA single line, where the start point is the left and top and the end point is the right and bottom.

 

Emitter ShapesApart from the distribution shapes, you can also define the distribution curve for the particles that are to be emitted. The available constants for distribution curves are listed below:

Particle Emitter Distribution Constant
ConstantDescription
ps_distr_linearA Linear distribution where all particles have an equal chance of appearing anywhere in the area.
ps_distr_gaussianA gaussian distribution where more particles are generated in the center rather than the edges.
ps_distr_invgaussianAn inverse gaussian distribution where more particles are generated at the edges than center.

 

Emitter Distribution

NOTE If you need the emitter to move with an instance, you will have to use this function in the step event and update the emitter position that way. It is also worth noting that for point emissions where you do not need to create particles over an area or with a specific distribution, it is often easier to use part_particles_create.

 

Syntax:

part_emitter_region(ps, ind, xmin, xmax, ymin, ymax, shape, distribution);

ArgumentTypeDescription
psParticle System InstanceThe particle system that the emitter is in.
indParticle Emitter IDThe index of the emitter to set.
xminRealThe x coordinate of the left side of the region.
xmaxRealThe x coordinate of the right side.
yminRealThe y coordinate of the top of the region.
ymaxRealThe y coordinate of the bottom of the region.
shapeParticle Emitter Shape ConstantThe shape of the region.
distributionParticle Emitter Distribution ConstantThe distribution style of the particles.

 

Returns:

N/A

 

Example:

part_emitter_region(global.Sname , emit_1, x - 50, x + 50, y - 50, y + 50, ps_shape_ellipse, ps_distr_linear);

The above code will set an emitter to the a 100px tall and 100px wide elliptical shape around the current (x,y) position of the instance running the code.