move_snap

Snaps the player to the nearest position on a grid with cells of a given size.

Syntax:

move_snap( hsnap, vsnap );


Argument Description
hsnap The horizontal snapping (the size in pixels between 'cells').
vsnap The vertical snapping (the size in pixels between 'cells').


Returns: N/A


Description

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.


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.


Back: Moving Around
Next: place_snapped
© Copyright YoYo Games Ltd. 2018 All Rights Reserved