• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker place_meeting VS place_empty

Z

zendraw

Guest
why wuld you use place meeting and not place empty? they seem to be pretty much the same thing. whats the diffrence?
 
O

OwainHorton

Guest
I use place empty for when for example i want to create an object and i want to check if an object already exists there.
I wouldn't recomend place empty for collisions because maybe theres for example an object called "Grass" and returns that the place isn't empty when you just want it to collide with object called "Rock".
 

chamaeleon

Member
why wuld you use place meeting and not place empty?
Taking the question literally, you would use place_meeting() because you want to make sure a specific object instance is not present at the location while some other kind of object instance could be but you don't care.
 
Z

zendraw

Guest
place empty allows checking for a specific object, thats why im asking.
 
P

ParodyKnaveBob

Guest
Taking the question literally, you would use place_meeting() because you want to make sure a specific object instance is not present at the location while some other kind of object instance could be but you don't care.
zendraw's right that they (now) do pretty much the same thing. Perhaps under the hood one's faster or something, but the manual shows at some point YYG added an optional argument to place_empty().

GML:
place_meeting(x, y, obj_goal) == !place_empty(x, y, obj_goal)
To answer zendraw, you have my indirect answer above. Maybe you'd use one over the other for some hidden reason now – or just frankly that you like the semantics of one over the other, and/or you can skip ! checks – but for probably 15 years or so, place_empty() did not have the optional object argument and was thus more akin to place_free().

Regards,
 
Z

zendraw

Guest
my only guess is they have some plans for it in the future? perhaps it shuld be tested how taxing is place_meeting vs place_empty.
 
Top