position_meeting

Checks a position for a collision with a specific object.

Syntax:

position_meeting(x, y, obj);


Argument Description
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.


Returns: Boolean


Description

With this function you can check a position for a collision with another instance or all instances of an object. When you use this you are checking a single point in the room for an instance or an object. 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 know 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.


Example:

if mouse_check_button(mb_left)
   {
   if !position_meeting(mouse_x, mouse_y, all) instance_create(mouse_x, mouse_y, 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.


Back: Collision Checking
Next: position_change
© Copyright YoYo Games Ltd. 2018 All Rights Reserved