It’s been a bit since I posted, I’m now onto my journey into the wonderful world of XNA development for the xbox…w00t. Ran through the 3D and 2D tutorials and it’s been a blast so far. So I decided it’s time and what better way to learn then to start working towards some goals. A Hexagonal Turn-Based Strategy game written the ground up in C# on the XNA framework…big talks, but not out of the realm of possibility. While kicking around a few ideas with a couple of buddies, I think I’ve stumbled upon the way to make this work.
Figure A Hex:
So while this approach may be suited for checkers or chess, I would only allow your avatar four directions to move in, not six.
Figure B Hex
So then I tried the hex approach, but quickly learned this would be a pain in the butt to keep track of in code. Yes this would be the most ‘true’ representation of a 6-sided diamond shape, but still not quite what I was looking for.
Ok so I think I figured it out!
Init your array of 5×5, 6×6, etc…
Draw the tiles so they overlap and then null out the in betweens.
So if you are standing on L then you could potentially move NW, NE, E, SE, SW, or W.
The logic would be something like get current position in x, y. the possible movements would then be:
//these would be your current position
Init xPos (get)
Init yPos (get)
NW = (xPos -1 , yPos +1)
NE = (xPos +1, yPos +1)
E = (xPos +2, yPos)
SE = (xPos +1, yPos -1)
SW = (xPos -1, yPos -1)
W = (xPos -2, yPos)
Does that sound sane? I think so! Now I just have to do some coding to try it out!