## **part_type_speed**
**设置给定粒子的最小和最大速度。**
#### **语法:**
part_type_speed(ind, speed_min, speed_max, speed_incr, speed_wiggle);
| 参数 | 描述 |
| --- | --- |
| ind | 粒子类型ID |
| speed_min | 粒子初始的最小速度 |
| speed_max | 粒子初始的最大速度 |
| speed_incr | 粒子速度每步增加或减少多少 |
| speed_wiggle | 每步从粒子的速度中随机添加或减去多少 |
**返回:** N/A
#### **描述**
此功能用于确定粒子创建时的速度,也可用于使粒子在其整个生命周期中每一步增加或降低速度。最小和最大速度值默认为1,这意味着粒子每步移动1个像素,如果它们设置为相同的值,所有粒子的初始速度将相同,但如果设置为不同的值,每个粒子将以给定范围内的随机速度开始。例如,如果您的最小值为3,最大值为6,则将以每步三到六个像素的速度创建指定粒子。
您还可以设置一个增量值,使粒子在其整个生命周期中每一步按照设置移动得更快(如果是正数)或更慢(如果是负数)。该值最小值是(+/-)0.01。
最后,你可以设置“摆动”的因素。这是一个在粒子寿命中每一步都会随机添加或减去的值。显然,较大的值比较小的值更明显,而这个值甚至可以是负值,最大范围在-20和20之间。
#### **举例:**
~~~
part_type_shape(particle2, pt_shape_flare);
part_type_size(particle2, 0.01, 0.50, 0.01, 20);
part_type_scale(particle2, 0.10, 0.10);
part_type_colour3(particle2, 4210816, 4227327, 8240895);
part_type_alpha3(particle2, 0.20, 0.80, 0);
part_type_speed(particle2, 5, 10, -0.20, 20);
part_type_direction(particle2, 0, 359, -1, 20);
part_type_gravity(particle2, 0, 270);
part_type_orientation(particle2, 0, 359, 0, 20, 1);
part_type_blend(particle2, 1);
part_type_life(particle2, 1, 20);
~~~
上面的代码将设置各种粒子值,包括设置最小速度为5和最大速度为10的初始速度,且每步降低-0.2的值。每一步速度也会额外增加0到20之间的随机值。
- 简言
- 额外接口
- 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)