Log In  


Hello! I was wondering if there is any to get a sprite to snap to a 16x16 grid like a map cell would, my main goal here is to make a sort-of mini map editor, but I can't seem to get the sprite to snap to the correct coordinates. Thank you!



if x/y are your mouse/cursor coordinates, snapping to the grid is:

local gx,gy=16*flr(x/16),16*flr(y/16)

Or

local gx,gy=band(x,0xf0),band(y,0xf0)


[Please log in to post a comment]