Blecki vient de poster un nouveau tutoriel très complet sur le site du Sergeant Conker qui explique comment utiliser une carte basée sur des tuiles hexagonales. Ce système de tuiles hexagonales fait notamment partie du moteur de jeu programmé par Blecki, à savoir le Jemgine.
We will use Vector2 as our hex tile map coordinates. Tile map coordinates increase to the right and up.
We will need to turn tile map coordinates into world coordinates. There are two points that make logical tile origins. There is the center of the tile, and there is the point outside the hex, as in the diagram.
Whichever you use, the value is the same. All you're changing is which of these you position at 0,0. Be consistent in your drawing code, and these two values will be the same. This does make a different later, in the conversion from world coordinates back to tile coordinates. The origin point is the easier to work with there, so that's what we'll use here.
Le tutoriel est fourni avec un exemple de projet à télécharger, ainsi que de nombreuses illustrations pour faciliter la compréhension du code.