instance_place(x,y,obj)

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

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

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

 

Example:

it = instance_place(x+hspeed,y+vspeed,obj_badguy);

 

Unlike instance_position() this function will tell you if there would be a collision with obj if the object that does the check was placed at position (X,Y). So the 'place' where the check is made is all the pixels in the sprite. If any of those overlap a pixel in the other sprite the function return true.

 

Example #2:

hereIsAWall = instance_place(x+speed,y,obj_impassable);

if(speed>0 && hereIsAWall)

{

x=hereIsAWall.x-sprite_width;speed=0;

}

else if(speed<0 && hereIsAWall)

{

x=hereIsAWall.x+hereIsAWall.sprite_width;speed=0;

}

 

SpectreNectar - Revision #1