Page 1 of 1

Hexagonal Tiles on a Square Grid??

PostPosted: 23 Apr 2011, 18:30
by Comz
This has been bugging me for a while now and I havn't managed to sort it yet. I'm working with a 2D game engine that used a Square Grid Map. I'm looking to add Hexagonal tiles to this, however can't seem to do it efficiently.

I want the Hex tiles to touch, no gaps in-between. If I do this by changing the pixel_x/y of the tiles, I end up screwing up their location after a while. I can off set them by half a tile without any issues, but it still leaves gaps.

How would you do this?

Re: Hexagonal Tiles on a Square Grid??

PostPosted: 24 Apr 2011, 02:44
by charlie
You can consider a hexagonal grid to be a slanted square grid.

Consider:

{l Code}: {l Select All Code}
._
/1\_
\_/3\
/2\_/
\_/4\
  \_/

.--.--.
|1 |3 |
|--|--|
|2 |4 |
'--'--'


So you can plot a path between any two squared in the grid using 'hex' rules i.e. which surrounding squares would be next to the context square if you were to offset them as in a hex grid.

Does that help?