使用此函数,可以检查位置是否与另一个实例或物体的所有实例发生碰撞。使用此选项时,将检查房间中单个点的实例或物体。This check will be done against the bounding box of the instance or against the mask of the instance if that instance has precise collisions checked. If you need to get the unique instance id if the object being collided with you should use instance_position. This function also accepts the special keywords all and other.


position_meeting(x, y, obj);

参数 描述
x The x position to check.
y The y position to check.
obj The object (or instance id, or the keywords "all" or "other") to check for a collision with.




if mouse_check_button(mb_left)
   if !position_meeting(mouse_x, mouse_y, all) instance_create_layer(mouse_x, mouse_y, "Walls", obj_Wall);

The above code checks for the left mouse button, and if it is pressed it checks the mouse x/y position for a collision with any instance. If there is none, then an instance of "obj_Wall" is created.