Drawing hex tiles in Cocos2d for iOS
I want to draw a hexagonal tile map. The TMX files they include is more heavyweight than simply the hex grid I need. I don't need images just a black/transparent background with the hex outline on top.
So far I have this:
CCTMXTiledMap *map = [CCTMXTiledMap tiledMapWithTMXFile:@"h开发者_JAVA百科exa-test.tmx"];
Is there a built-in routine or standard approach for doing this?
(I am new to cocos2d for iOS.)
Thanks
As far as I've seen in Cocos2D, the tilemap is the only built-in way to draw a hex map. If you want anything else, you'll have to roll your own -- but I don't think it's going to be all that difficult to do.
Try this page for info on a basic hex drawing algorithm.
There's also this page which draws many hexagons in a map.
Hope that helps.
Mike
精彩评论