## part\_system\_create\_layer
#### **描述**
这个函数将在给定的图层上创建一个新的粒子系统。您将函数layer_create()创建图层后返回的唯一图层ID或用字符串为图层的名称(例如“instance_layer”)赋予该值,然后将设置标记为永久的或不持久的。如果粒子系统被标记为永久性的,那么它将在所有房间被创建之后持续存在(并且如果在后续房间中不存在对应图层,则自动分配托管层),但是如果为不持久,则系统将是在创建它的房间销毁的末尾自动销毁(这与您调用函数part_system_destroy相同,也将销毁与系统关联的所有发射器)。该函数将为粒子系统返回一个唯一的ID值,该值用于需要提供系统ID的所有其他函数调用中。
**重要**!如果您将粒子系统标记为持久性的,那么它(以及分配给它的任何发射器)在不使用时需要使用销毁函数手动清理,否则会出现内存泄漏,从而对最终游戏产生不好的影响。
#### **语法:**
part_system_create_layer(layer_id, persistent);
| 参数 | 描述 |
| :--- | :--- |
| layer | 这个函数将在给定的图层上创建一个新的粒子系统。 填写图层ID或字符串来指定(可以是任何图层类型) |
| persistent | 将粒子系统标记为永久(设置为true)或不设置(设置为false) |
**返回: **
数值(系统粒子的唯一值)
#### 举例:
```js
global.p_sys = part_system_create_layer("effects_layer", true);
```
上面的代码将在给定的图层上创建一个新的粒子系统,并将其标记为保留在后续的房间中。 粒子系统的ID存储在全局范围变量中以备将来使用。
- 简言
- 额外接口
- 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)