• 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 Where exactly is x or y in my sprite?

J

Jaco

Guest
Hi

This seems like something so basic, however I can't seem to find an answer..
Lets say I have an object with a sprite 16x16 pixels.

If I go into the code and use the built in variable x or y,
where is the value x or y? is it at the origin of my sprite?

I have this line of code:
if (!place_meeting(x + sign(newX), y, obj_wall))

This is part of my collision code and it works fine, but I don't really know why because I don't know what the value of x actually is in respect to my origin of the sprite.
I looked up x and y in the manual and they just say it the position of the sprite, not where its measured from.

Thanks in adcance
 

hogwater

Member
I think the confusion is because when using place_meeting, the function is checking collision masks. Meaning that something like 'x+1' used in that function means the pixel to the right of the calling object's collision mask, or bounding box instead of the object's 'origin+1.'
 
Top