The problem is that in tile-map.xml theres a repeated typo: 'title' when it
should be 'tile' ; that is, each cell should be <cell tile="h0" />
I noticed another problem: the tile-tile.xml specifies a square tile
128x128, and that does not comply the requirements for a hex tile:
- it should depict an hexagon with up and right sides parallel to x axis
- the hexagon touches all sides of the texture
- from the two above and geometry it should hold
width = int(height / sqrt(3) * 2)
For hexmap use cocos from the repository (
http://code.google.com/p/los-cocos/ ) , some recent commits fixed problems
with hexmaps.
You can take a look to issue 203
http://code.google.com/p/los-cocos/issues/detail?id=203
for a sample script doing mouse hit over a hexmap (should you need that);
issues; issue 201 has the necessary resources including a tile with good
proportions.
On Sun, Sep 8, 2013 at 1:47 AM, Tom Goldstein <[email protected]> wrote:
> Hello, I would like to use the Hexmap feature, however the test and
> samples folders do not have an implementation. I've adapted the tile_test
> program and dived into the source to see how to format the xml. It is
> supposed to show a 4x4 hex 'grid'. It gives no errors, but does give a
> blank screen. Is the following looking at all correct or did I just screw
> things up?
>
> Code:
>
> import cocos
> from cocos import tiles, actions, layer
>
> def main():
> from cocos.director import director
> director.init(width=600, height=600, resizable=True)
>
> scroller = layer.ScrollingManager()
> tile_layer = tiles.load('tile-map.xml')['map0']
> scroller.add(tile_layer)
> scroller.set_focus(10,10)
>
> main_scene = cocos.scene.Scene(scroller)
>
> director.run(main_scene)
>
> if __name__ == '__main__':
> main()
>
>
> tile-map.xml:
> <resource>
> <requires file="tile-tile.xml" />
> <hexmap id="map0" origin="20,0,0" tile_height="168">
> <column>
> <cell title="h0" /><cell title="h0" /><cell title="h0" /><cell title="h0"
> />
> </column>
> <column>
> <cell title="h0" /><cell title="h0" /><cell title="h0" /><cell title="h0"
> />
> </column>
> <column>
> <cell title="h0" /><cell title="h0" /><cell title="h0" /><cell title="h0"
> />
> </column>
> <column>
> <cell title="h0" /><cell title="h0" /><cell title="h0" /><cell title="h0"
> />
> </column>
> </hexmap>
> </resource>
>
>
> tile-tile.xml:
> <resource>
> <imageatlas size="168x168" file="Regular_hexagon.png">
> <image id="h0" offset ="0,0"/>
> </imageatlas>
> <tileset>
> <tile id="h0">
> <image ref="h0"/>
> </tile>
> </tileset>
> </resource>
>
>
> Thanks very much for taking a look! I can also zip the folder and attach
> if that would be easier.
>
> Cheers,
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "cocos2d discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cocos-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/groups/opt_out.