Hexagonal Tiles on a Square Grid??

Hexagonal Tiles on a Square Grid??

Postby Comz » 23 Apr 2011, 18:30

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?
Comz
 
Posts: 1
Joined: 23 Apr 2011, 18:24

Re: Hexagonal Tiles on a Square Grid??

Postby charlie » 24 Apr 2011, 02:44

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?
Free Gamer - it's the dogz
Vexi - web UI platform
User avatar
charlie
Global Moderator
 
Posts: 2131
Joined: 02 Dec 2009, 11:56
Location: Manchester, UK

Who is online

Users browsing this forum: No registered users and 1 guest

cron