physics_test_overlap

This function can be used to check and see if a physical body (i.e. the fixture of an instance) overlaps, or will overlap, when rotated and placed at a given position in the room. the "angle" argument is the angle of rotation that the calling instance has (or will have) at the position to be checked, and the "obj" argument can be either a single instance id, and object index or the keywords all or other.

 

Syntax:

physics_test_overlap(xpos, ypos, angle, obj);

ArgumentTypeDescription
xposRealThe x position in the room to check
yposRealThe y position in the room to check
angleRealThe angle to check (of the calling instance)
objObject Asset or Object InstanceThe object to check for

 

Returns:

Boolean

 

Example:

if physics_test_overlap(x+20, y-35, 0, obj_Bomb)
{
    alarm[0] = game_get_speed(gamespeed_fps);
    ignited = true;
}

The above code will check a position for a physics fixture overlap, and if there is one, it sets a variable and an alarm.