This project contains very useful tools for projects involving a hexagonal grid drawn with the pen. This project: * draws a grid of hexagons of any size with a random orientation, * identifies which cell is clicked and changes its color, * is able to find the shortest path between two cells
Feel free to use anything for your own projects. I found the algorithm that identifies the hexagon cell from x, y coordinates on: http://www.redblobgames.com/grids/hexagons/ I actually spent hours trying to work out the algorithm on my own, but it proved to be a bit too hard for me, so I just implemented it without understanding it. The algorithm for finding the shortest path is a simple implementation of the A* algorithm http://en.wikipedia.org/wiki/A*_search_algorithm