2 ms·
This is a fantastic game. I’m curious, did you use a special coordinate system for the hexagons or did you just make it work without any sort of coordinate sys
by Waterluvian 4y ago
This is a fantastic game.
I’m curious, did you use a special coordinate system for the hexagons or did you just make it work without any sort of coordinate system at all?
- gereleth 4y agoI didn't use any special coordinates, just some trigonometry. My code transforms coordinates between (x,y) - for drawing, (row, column) - for finding neighbours and (index into an array of tiles) - for managing state. It sort of grew organically and could probably be cleaned up a lot. The hardest part was making the board repeat for the wrap variant making sure that all tiles have consistent wrap neighbours. I almost deployed a version that worked fine on odd-sized grids and went completely bananas on even-sized grids. The danger of always testing on a 5x5 board)).