part_emitter_region

此函数用于设置粒子发射器在当前房间中的位置。指定函数内区域的边界框,然后使用一系列常量中的任何一个来定义此边界框内的最终发射器形状以及形状内的粒子分布。下面列出了分布形状的可用常量:

粒子发射器形状常量
常量描述
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 Shapes除了分布形状之外,还可以定义要发射的粒子的分布曲线。下面列出了分布曲线的可用常量:

粒子发射器分布常数
常量描述
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

注意:如果需要发射器随实例一起移动,则必须在步骤事件中使用此函数,并以此方式更新发射器位置。另外值得注意的是,对于不需要在区域上创建粒子或具有特定分布的点发射,通常更容易使用part_particles_create

 

语法:

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

参数类型描述
psParticle System Instance发射器所在的粒子系统。
indParticle Emitter ID要设置的发射器的索引。
xminReal区域左侧的x坐标。
xmaxReal右侧的x坐标。
yminReal区域顶部的y坐标。
ymaxReal区域底部的y坐标。
shape粒子发射器形状常量区域的形状。
distribution粒子发射器分布常数粒子的分布样式。

 

返回:

N/A

 

例子:

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

上述代码将在运行代码的实例的当前(x,y)位置周围将发射器设置为100 px高和100 px宽的椭圆形状。