## **part_emitter_region**
**设置给定发射器的区域和分布设置。**
#### **语法:**
part_emitter_region(ps, ind, xmin, xmax, ymin, ymax, shape, distribution);
| 参数 | 描述 |
| --- | --- |
| ps | 关联的粒子系统ID |
| ind | 粒子发射器ID |
| xmin | X坐标范围最小值 |
| xmax | X坐标范围最大值 |
| ymin | Y坐标最小值 |
| ymax | Y坐标最大值 |
| shape | 形状类型 |
| distribution | 分布样式 |
**返回:** N/A
#### **描述**
此功能用于在当前房间内设置其粒子发射器的位置。您可以在函数中指定区域的边界范围,然后使用一系列常量中的任意一个来定义此边界范围中的发射器形状以及形状内的粒子分布样式。下面列出了可用的分布形状常量:
| 常量 | 描述 |
| --- | --- |
| ps_shape_rectangle | 矩形形状 |
| ps_shape_ellipse | 椭圆形状 |
| ps_shape_diamond | 菱形形状 |
| ps_shape_line | 线形形状,从左上到右下 |
![发射器区域形状](https://box.kancloud.cn/be54f9b6fa88dd2f72953c0bff131f57_1124x321.png)
* * * * *
除了分布形状之外,还可以定义要发射的粒子的分布曲线。下面列出了分布曲线的可用常量:
| 常量 | 描述 |
| --- | --- |
| ps_distr_linear | 线性、均匀分部 |
| ps_distr_gaussian | 高斯分部,中心会分部更多的粒子 |
| ps_distr_invgaussian | 逆高斯分部,边缘会分部更多的粒子 |
![分部样式](https://box.kancloud.cn/5ee9b3a85fedbc641607138d82074e8f_848x321.png)
**注意:** 如果您需要使用实例移动发射器,则必须在步事件中使用此功能和更新发射器位置。还值得注意的是,对于不需要在区域或特定分布上创建粒子的分部的话,使用part_particles_create通常更加简易。
#### **举例:**
~~~
part_emitter_region(global.Sname , emit_1, x - 50, x + 50, y - 50, y + 50, ps_shape_ellipse, ps_distr_linear)
~~~
上面的代码将会在运行代码的实例的当前(x,y)位置设置一个100px高和100px宽椭圆形状的发射器。
- 简言
- 额外接口
- asset_get_index
- asset_get_type
- 粒子(PARTICLE)
- 简单粒子系统
- effect_create_below
- effect_create_above
- effect_clear
- ef_all
- 粒子系统
- 粒子系统的创建
- part_system_exists
- part_system_create
- part_system_create_layer
- part_system_get_layer
- part_system_layer
- part_system_clear
- part_system_depth
- part_system_position
- part_system_destroy
- part_particles_clear
- part_particles_count
- 系统绘图
- part_system_automatic_update
- part_system_automatic_draw
- part_system_update
- part_system_drawit
- part_system_draw_order
- 直接创建粒子
- part_particles_create
- part_particles_create_colour
- 粒子类型
- part_type_exists
- part_type_create
- part_type_destroy
- part_type_clear
- part_type_shape
- part_type_sprite
- part_type_size
- part_type_scale
- part_type_speed
- part_type_direction
- part_type_gravity
- part_type_orientation
- part_type_colour_mix
- part_type_colour_rgb
- part_type_colour_hsv
- part_type_colour1
- part_type_colour2
- part_type_colour3
- part_type_alpha1
- part_type_alpha2
- part_type_alpha3
- part_type_blend
- part_type_life
- part_type_step
- part_type_death
- 粒子发射器
- part_emitter_exists
- part_emitter_create
- part_emitter_clear
- part_emitter_region
- part_emitter_burst
- part_emitter_stream
- part_emitter_destroy
- part_emitter_destroy_all
- 数组(array)
- 数据结构(Data structures)
- 心得分享
- ds_exists
- ds_set_precision
- 网格(grid)
- ds_grid_create
- ds_grid_destroy
- ds_grid_width
- ds_grid_height
- ds_grid_resize
- ds_grid_clear
- ds_grid_set
- ds_grid_set_disk
- ds_grid_set_grid_region
- ds_grid_set_region
- ds_grid_shuffle
- ds_grid_sort
- ds_grid_get
- ds_grid_get_max
- ds_grid_get_mean
- ds_grid_get_min
- ds_grid_get_sum
- ds_grid_get_disk_max
- ds_grid_get_disk_mean
- ds_grid_get_disk_min
- ds_grid_get_disk_sum
- ds_grid_add
- ds_grid_add_region
- ds_grid_add_disk
- ds_grid_add_grid_region
- ds_grid_multiply
- ds_grid_multiply_disk
- ds_grid_multiply_region
- ds_grid_multiply_grid_region
- ds_grid_value_exists
- ds_grid_value_disk_exists
- ds_grid_value_x
- ds_grid_value_y
- ds_grid_value_disk_x
- ds_grid_value_disk_y
- ds_grid_copy
- ds_grid_read
- ds_grid_write
- 列表(list)
- 映射(map)
- 队列(Queues)
- 优先队列(Priority Queues)
- 堆栈(stack)