gravity_direction

The direction of gravity for the instance.

Syntax:

gravity_direction;


Returns: Real


Description

All instances in GameMaker: Studio have certain "built in" properties that you can use and set to govern how they look and behave. Gravity_direction is one of those properties and can be used to set the direction of movement when the instances gravity is greater than 0. Note that directions in GameMaker: Studio are usually calculated as 0° being right, 90° being up, 180° being left and 270° being down.


Example:

if place_meeting(x, y, obj_switch)
   {
   gravity_direction += 180;
   }

The above code will change the gravity_direction if the player object meets an instance of "obj_switch".


Back: Moving Around
Next: hspeed
© Copyright YoYo Games Ltd. 2018 All Rights Reserved