part_type_gravity

Sets the gravity of the given particle type.

Syntax:

GML Code Example

part_type_gravity(ind, grav_amount, grav_direction);


Argument Description
ind The index of the particle type to change.
grav_amount Strength of the gravity.
grav_direction The direction of the gravity.


Returns: N/A


Description

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 directions of 0� being right, 90� being up, 180� being left and 270� being down.


Example:

GML Code Example

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.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here