Gravity_direction is one of the "built in" properties all instances have and can be used to set the direction of movement when the instances gravity is greater than 0. Note that directions in GameMaker Studio 2 are usually calculated as 0° being right, 90° being up, 180° being left and 270° being down.
gravity_direction;
Real(实数)
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".