开发者

Drawing hex tiles in Cocos2d for iOS

开发者 https://www.devze.com 2023-03-22 10:59 出处:网络
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 to

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

0

精彩评论

暂无评论...
验证码 换一张
取 消