gravity


描述

Gravity is one of the "built in" properties all instances have and, when set, will apply a constant force in the gravity direction of the instance, influencing its speed. 由于重力的性质,如果你不为物体设置一个速度上限,物体将一直加速


语法:

gravity;


返回:

Real(实数)


例如:

if !place_meeting(x, y + 1, obj_Ground)
   {
   gravity = 0.01;
   }
else
   {
   gravity = 0;
   }

The above code will only apply gravity if the instance does not find any instances of "obj_Ground" beneath it.