Scott McKenzie
Scott McKenzie

Reputation: 16242

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:@"hexa-test.tmx"];

Is there a built-in routine or standard approach for doing this?

(I am new to cocos2d for iOS.)

Thanks

Upvotes: 2

Views: 2325

Answers (1)

Mike Lorenz
Mike Lorenz

Reputation: 942

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

Upvotes: 1

Related Questions