phy_sleeping

Returns the active state of the instance.

语法:

phy_sleeping;


返回: 布尔值


描述

This read-only variable returns whether or not the instance is currently "sleeping" (true) or not (false), A "sleeping" instance is one that is not actively engaged in any physical simulation. GameMaker Studio 2 will put objects to sleep to save simulation cycles when an instance is at rest and not in collision with another instance.


例如:

if phy_sleeping
   {
   instance_destroy(); // 销毁实例
   }

The above code checks to see if the object is being actively simulated or not and if it is not it is destroyed.


上一页: Physics Variables
next: phy_collision_points
© Copyright YoYo Games Ltd. 2018 All Rights Reserved