phy_dynamic

动态实例是在物理世界中完全模拟的实例,如果被检查的实例是完全模拟的,则该只读变量将返回 true,否则返回 false

 

语法:

phy_dynamic;

 

返回:

Boolean (or undefined if the instance is not physics enabled)

 

例子:

if other.phy_dynamic
{
    with (other)
    {
        var _dir;
        _dir = point_direction(x, y, other.x, other.y);
        physics_apply_impulse(x, y, x + lengthdir_x(100, dir), y + lengthdir_y(100, dir));
    }
}

上面的代码检查另一个实例是否为动态物理实例。如果是,则在这个另一个实例中执行一些代码:使用 point_direction 计算两个实例之间的方向,并使用 physics_apply_impulse 对另一个实例应用脉冲 100。