On the Hexagon Implementation page I have a Layout
class that controls how to convert back and forth between hexagonal coordinates and screen coordinates. It has parameters (size.x
, size.y
, origin
) that aren't explained on the hexagon concepts page. That's in part because they complicate the explanation and aren't hexagon-specific. The size is a standard scale transform and the origin is a standard translate transform. Although I have some explanation on the implementation page, it's not very good. I made some improvements:
- Added axes and measurements to the visualizations so that you can
see how the
size
andorigin
parameter affect the size and position of the hexagons. - Added common uses of these two parameters, in a more “how to”
style. The
size
is useful for stretching/shrinking your hexagons to match pixel/sprite art, or for flipping the y-axis. Theorigin
is useful for setting x=0,y=0 to be the origin hexagon's top left instead of its center.
Here's how the size
example looked before. I gave two different sizes and showed these diagrams:
Here's how the size
example looks after. I give the two sizes, but the reader can read the sizes by looking at the axis labels, and can also visually see the dimensions formed by the measurements lines. I also give the formula instead of making the reader figure it out themselves.
I'm pretty happy with this change. Fitting hexagons to existing sprite art is something I knew was possible but I hadn't sat down with pen & paper to figure the formulas out until now.
I just wanted to give a shout out to all of your work, and specifically the hex work. It is fantastic and a great resource for those of us who are dabbling in game development! It literally saves weeks of effort on our part! Many thanks!
The only part I struggled (so far) was with the origin, which I see you've called out more explicitly here. Once I realized that, things really clicked.
Keep it up, I'm sure there are lurkers like me who really appreciate and value your work!
Thank you!
Post a Comment