position_meeting & place_meeting, what's the difference???

Pedro Y

As you can see in the title, I am genuinely confused by the difference between those 2. I was trying to let an object destroy itself when clicked by the mouse, and I tried
if (mouse_check_button(mb_left)) && (place_meeting(mouse_x,mouse_y,self)) instance_destroy();
, but it didn't work. I then tried the same thing with position_meeting,
if (mouse_check_button(mb_left)) && (position_meeting(mouse_x,mouse_y,self)) instance_destroy();
, and it worked just fine. Can someone please explain?


position_meeting() takes a point at the coordinates you specified and checks if the specified object is there.

place_meeting() takes the object running the code and places it at the coordinates you specified, then checks if the specified object collides with it.

self can't collide with self, now can it?



Read up: What's the Difference: Collision Functions
Place vs. Position
The most important difference is whether the function name contains place or position Functions starting with place always put the current instance that is executing the code at the specified position and checks if its sprite (or mask if assigned) collides with another object.

On the other hand, functions named position checks the exact point, regardless of the instance that is executing the code.


Here are some consequences:
  • place_*() functions don't work at all if the instance executing the code has no sprite or mask.
  • place_*() functions never detect collision with itself, whereas position functions can be used with self.


place_meeting(x, y, A): Do I collide with A if I'm at (x, y)?
position_meeting(x, y, A): Does A collide with point(x, y)?