Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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.