place_snapped

Returns whether the calling instance is aligned with the snapping values.

Syntax:

place_snapped(hsnap, vsnap);


Argument Description
hsnap The horizontal snapping to check.
vsnap The vertical snapping to check.


Returns: Boolean


Description

With this function you can check and see if the origin of an instance (its x and y position) is aligned to a grid with the hsnap and vsnap values specified by you.


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: move_wrap
© Copyright YoYo Games Ltd. 2018 All Rights Reserved