position_empty

此函数将检查给定位置是否与给定位置处具有有效碰撞遮罩的任何实例发生碰撞。

 

语法:

position_empty(x, y);

参数类型描述
xReal要检查的x位置。
yReal要检查的y位置。

 

返回:

Boolean

 

例子:

var xx, yy;
xx = random(room_width);
yy = random(room_height);
if (position_empty(xx, yy))
{
    instance_create_layer(xx, yy, "Bullets", obj_Bomb);
}

这将检查房间中某处的随机位置是否存在碰撞,如果没有碰撞,则将创建obj_Bomb实例。