Hexagon tile grids

A small demo of how you interact with a tilebased grid. Documented source code included and the math behind it is fairly basic. Basically it builds a grid from code, rotates for 5 seconds every 5 seconds and highlights the tile your mouse is over. I couldn’t find a good example online so here it is.

All the documentation is in the source code, and here is the image the code refers to:

Download the sources here: Hexagon sample (1028 downloads)


Print Friendly, PDF & Email
2 replies
  1. Mischaal
    Mischaal says:

    Hi! I took your example and had some problems with positioning the hexagons.
    Dependent on the hexagon size the lines don’t fit exactly. So it seems not every line fits perfectly to the adjacent hex field. Is this a mathematical fault or am I doing it wrong?

    • Hans Wichman
      Hans Wichman says:

      Hi Mischaal, lemme know what you’ve changed and what it is that is happening, I checked with a different hex size and it seems to work okay, so I’m curious now 😉 best Hans


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *