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!

P#62313 2019-02-28 04:02

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

local gx,gy=16*flr(x/16),16*flr(y/16)
P#62315 2019-02-28 06:35


local gx,gy=band(x,0xf0),band(y,0xf0)
P#62321 2019-02-28 15:16

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-03-20 12:14:40 | 0.005s | Q:12