Snap To Isometric Grid?
Does anyone know how I can snap actors to the center of isometric squares? There are lots of city/kingdom/ building games that use this isometric yard/landscape in which has a grid which you place your buildings/houses etc on. I was wondering how I could achieve snapping my images (Made to look 3d) onto these squares?
I saw a previous template that used the following to snap to a 2d grid:
Constrain attribute: Self.Position.x To floor(Self.position.x/64)64)+32
Constrain attribute: Self.Position.y To floor(Self.position.y/64)64)+32
That snnapped my 64x64 pixel blocks to the center of a grids blocks, now, how can I achieve this same effect with an isometric grid? I'm not sure if it would take some tweaking with the formula above or of Id need something completely different, help would be greatly appreciated!
Comments
I believe @Socks posted a nice isometric sample at one time or another, maybe he can offer some advice.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Bump
Well, it depends on how your isometric imagery is set up, but mostly y=1/2*x, meaning the height of the tiles is half of their width. If that is the case, your calculation should be:
Constrain attribute: Self.Position.x To floor(Self.position.x/64)*64)+32
Constrain attribute: Self.Position.y To floor(Self.position.y/32)*32)+16