• 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!

Help place_meeting function

Can someone help me understand why this doesn't work:

GML:
(place_meeting(Object51.x + 1, Object51.y + 1 , Object1) or place_meeting(Object51.x - 1, Object51.y - 1 , Object1))
when this does work:

GML:
(place_meeting(x + 1, y + 1 , Object1) or place_meeting(x - 1, y - 1 , Object1))
 
Because you don't close the brackets, nor do anything after the if statement.


In all seriousness, what do you mean by "doesn't work"?
 

FrostyCat

Redemption Seeker
Learn the difference between objects and instances.
NEVER access a single instance by object ID if multiple instances of the object exist. This includes attempts to reference or set object.variable (which is inconsistent across exports) and using with (object) to apply actions to it (this encompasses all instances of the object instead of just the one you want). Verbally, "Dog's colour" makes sense with one dog, but not with multiple dogs.

Corollary: NEVER set or use an instance's own variables with object.variable. An instance's own variables can be referenced as-is without dot prefixes. DO NOT use self. If multiple instances of the object exists, you might end up setting the value for all instances or for some other instance (depending on the export).
 

Nidoking

Member
place_meeting uses the notion of "self". If you're calling it from your Object51, then you're using the bounding box of the Object51. If you're calling it from something else, then it's using Object79's bounding box. Or Object23's. Or ObjectWhyAreTheseNotNamed's?
 
place_meeting uses the notion of "self". If you're calling it from your Object51, then you're using the bounding box of the Object51. If you're calling it from something else, then it's using Object79's bounding box. Or Object23's. Or ObjectWhyAreTheseNotNamed's?
Yeah I don't name some Objects lol, thanks for the info I'll try some other way to get this to work
 

TheouAegis

Member
If you are trying to check if object51 is in a collision with object1 from outside either object, you should call place_meeting() from inside "with Object51 { }".
 
Top