Sets the gravity of the given particle type.


part_type_gravity(ind, grav_amount, grav_direction);

参数 描述
ind The index of the particle type to change.
grav_amount Strength of the gravity.
grav_direction The direction of the gravity.

返回: N/A(无返回值)


This function will set the gravity that is to affect each particle of the given type that is created. The gravity strength value is added to the particle speed every step and is usually a small value like 0.5, while the direction is the direction of the gravity "pull" and follows the standard GameMaker Studio 2 directions of 0° being right, 90° being up, 180° being left and 270° being down.


part_type_shape(global.p1, pt_shape_pixel);
part_type_size(global.p1, 1, 3, 0, 0);
part_type_scale(global.p1, 1, 1);
part_type_colour1(global.p1, c_white);
part_type_alpha2(global.p1, 1, 0);
part_type_speed(global.p1, 2, 4, 0, 0);
part_type_direction(global.p1, 0, 180, 0, 0);
part_type_gravity(global.p1, 0.20, 270);
part_type_orientation(global.p1, 0, 0, 0, 0, 1);
part_type_blend(global.p1, 1);
part_type_life(global.p1, 15, 60);

The above code will set various particle values including the gravity which will add 0.2 to the speed each step with a direction of 270�, so will pull the particle "down" towards the bottom of the screen.

上一页: Particle Types
下一页: part_type_orientation
© Copyright YoYo Games Ltd. 2018 All Rights Reserved