此函数用于设置粒子发射器在当前房间中的位置。指定函数内区域的边界框,然后使用一系列常量中的任何一个来定义此边界框内的最终发射器形状以及形状内的粒子分布。下面列出了分布形状的可用常量:
粒子发射器形状常量 | |
---|---|
常量 | 描述 |
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. |
除了分布形状之外,还可以定义要发射的粒子的分布曲线。下面列出了分布曲线的可用常量:
粒子发射器分布常数 | |
---|---|
常量 | 描述 |
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. |
注意:如果需要发射器随实例一起移动,则必须在步骤事件中使用此函数,并以此方式更新发射器位置。另外值得注意的是,对于不需要在区域上创建粒子或具有特定分布的点发射,通常更容易使用part_particles_create。
part_emitter_region(ps, ind, xmin, xmax, ymin, ymax, shape, distribution);
参数 | 类型 | 描述 |
---|---|---|
ps | Particle System Instance | 发射器所在的粒子系统。 |
ind | Particle Emitter ID | 要设置的发射器的索引。 |
xmin | Real | 区域左侧的x坐标。 |
xmax | Real | 右侧的x坐标。 |
ymin | Real | 区域顶部的y坐标。 |
ymax | Real | 区域底部的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宽的椭圆形状。