I can't figure out how to setup a Hex Grid.
I have a tiled background with a hex grid and I want a sprite (the mouse cursor) to snap to the grid. If it's a simple square grid it'd be easy.
But my mind is failing me for a hex grid.
Any help?
A hexgrid is basically a square grid with odd rows offset by half cell width. You can do that by using modulus, so you just add 'half width' multiplied by the 'row index' mod '2', to the X coordinates.
here's a cap:
http://dl.dropbox.com/u/7871870/construct/hexgrid-01.cap
*Edit: if you want a more precise solution I found some links for reference:
http://playtechs.blogspot.com/2007/04/hex-grids.html
http://gdreflections.com/2011/02/hexagonal-grid-math.html
http://www-cs-students.stanford.edu/~amitp/gameprog.html#hex
Animmaniac
Thanks, I had made a hex board plugin(C2) from your cap file.
Develop games in your browser. Powerful, performant & highly capable.
I had released hex grid plugin on this post.
Nice rexrainbow! Thanks for letting me know.