move_snap

This function is used to "snap" the instance to a grid of a given size. It will be snapped to the nearest corresponding position on the "invisible" grid that the hsnap and vsnap values define.

 

Syntax:

move_snap(hsnap, vsnap);

ArgumentTypeDescription
hsnapRealThe horizontal snapping (the size in pixels between 'cells').
vsnapRealThe vertical snapping (the size in pixels between 'cells').

 

Returns:

N/A

 

Example:

with (obj_Pieces)
{
    if (!place_snapped(32, 32))
    {
        move_snap(32, 32);
    }
}

The above code checks all instances of "obj_Pieces" to see if they are snapped to a grid of 32x32 pixels, and if they are not it snaps them to the nearest position in that grid.