instance_position(x,y,obj)

x = Horizontal position of the point we're checking.

y = Vertical position of the point we're checking.

obj = The object we're checking if is there.

 

Example:

it = instance_position(x+sprite_width,y,obj_wall);

 

What does "position" mean? Position is a point in the room with the same size as a pixel. If you check for instances at a position the size of the sprite of the object that does the check doesn't matter. Only the sprite of the object that is searched for matters.

 

//the following will usually return false because the position

//where the check is made is at the top of the sprite+1 and not

//under the sprite.

//To make this return true you could make the y-origin of the

//sprite the height of the sprite -1.

//Why -1? Because the 0 is at the top, not 1.

amIStandingOnSomething = instance_position(x,y+1,obj_ground);

if(amIStandingOnSomething==false) y+=1;

 

SpectreNectar - Revision #1