Example on how to implement a pixel-to-hexagon-map-location algorithm.
Based on the assumption that if I needed this then probably someone else need it I wrote this little example to show how a pixel-to-hexagon-map can be implemented in python/pygame.
When you move around the mouse pointer the application will translate the mouse location to a hexagon map location and show this with a yellow hexagon.
Press space to toggle the display of the help grid square. You can use this to get a better understanding of the source code.
- Home Page
Pygame.org account Comments
Mee Master 2013-07-26 14:02:38
The way shown here is not good enough, since it is based on predefined matrix of hexes. I found a better method, which is more universal and works for every hex tile size. Mail me if you wish an example
user012 2014-11-19 14:46:29
The source code link is broken. Can someone help me?? Plz