pygame is
pygame.org is
|
HexagonExample
HexagonExample - 1.0John Eriksson (wmjoers)Tags:DescriptionUsing hexagon based maps is not as easy as using square maps. Mostly because it takes more effort to translate pixel locations (like mouse clicks) to map locations. When I search this issue on the net I found a really nice article explaining a technique to solve this matter with mathematics. But I wanted to have a pixel-perfect pixel-to-map algorithm so I used the article as a base and implemented a way to solve this.
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. Example Instructions 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. Links
ScreenshotReleases
Pygame.org account CommentsIf you wish to leave a comment with your pygame.org account, please sign in first.
|
|