Search code examples
iphoneobjective-cioscocos2d-iphonehexagonal-tiles

Cocos2d. Hexagonal map example


Are there any concrete examples of code using hexagonal maps with cocos2d? Except of drawing them manually, of course. I have found out that Tiled map editor (java version) allows to create these maps. But how to work with such map? I also don't know how to prepare a image for drawing into a hexagonal cell


Solution

  • My current solution is to draw manually. But I have found an interesting way to store this field into an usual 2d array. For examle:

    enter image description here

    where circles are hexagons.

    I can store this map as:

    0 1 0
    1 0 1
    0 1 0
    1 0 1
    0 1 0