Set Particle Gravity


Description

This action will simulate the effect of gravity on all particles of the given type. You first specify the particle type ID value (which should be the same as the value used when you created the particle using the Create Particle Type action) and then you can set the gravity force and the direction. Force is a cumulative value and will be added on to the speed vector each game frame, so a gravity of 1 will add one to the speed value each game frame, while the direction value is simply the direction in which gravity should "pull" the particle. Note that for both force and direction you can use negative values, and that direction in GameMaker Studio 2 is calculated with 0° to the right, 90° to the top, 180° to the left and 270° to the bottom.


Action Syntax:

Set Particle Gravity Syntax


Arguments:

Argument Description
Type ID The ID value for the particle type to set the gravity of
Force The force of the gravity (in pixels per game frame)
Direction The direction of the gravity "pull"


Example:

Set Particle Gravity Example
The above action block code will create a new particle type and assign its unique ID value to a global variable. It then proceeds to set all the properties for the particle type.