# part_emitter_region

## Sets the region and distribution settings for
the given emitter.

### 语法：

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

参数 |
描述 |

ps |
发射器所处的粒子系统。 |

ind |
The index of the emitter to set. |

xmin |
The x coordinate of the left side of the region. |

xmax |
The x coordinate of the right side. |

ymin |
The y coordinate of the top of the region. |

ymax |
The y coordinate of the bottom of the region. |

shape |
The shape of the region. |

distribution |
The distribution style of the particles. |

**返回：** N/A（无返回值）

### 描述

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:

常量 |
描述 |

ps_shape_rectangle |
A rectangular shape that fills the given area. |

ps_shape_ellipse |
An ellipse, with the width and height defined by the area. |

ps_shape_diamond |
A diamond shape with the points at half width and half
height. |

ps_shape_line |
A single line, where the start point is the left and top and
the end point is the right and bottom. |

Apart 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:

常量 |
描述 |

ps_distr_linear |
A Linear distribution where all particles have an equal chance
of appearing anywhere in the area. |

ps_distr_gaussian |
A gaussian distribution where more particles are generated in
the center rather than the edges. |

ps_distr_invgaussian |
An inverse gaussian distribution where more particles are
generated at the edges than center. |

**注意**： 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`.

### 例如：

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.

##### © Copyright YoYo Games Ltd. 2018 All Rights Reserved