move_snap

语法:

move_snap( hsnap, vsnap );


参数 描述
hsnap The horizontal snapping (the size in pixels between 'cells').
vsnap The vertical snapping (the size in pixels between 'cells').


返回: N/A(无返回值)


描述

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.


例如:

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.