Working with TMX

So I have no experience working with TMX. I have successfully created a TMX and loaded into a small test project (hexagon grid) in Creator. Now the questions:

  • Can I map the hexagons with a 2d array position (3,5)?
  • How can I detect which one I have touched?
  • How can I get its custom properties?
  • How can I add/change the sprite for a given position in the map?

Im trying to find tutorials for creator but couldn’t find a good example…
Anyone, please? :slight_smile:

Thanks!

I can’t really answer you questions because I ended up coding my own parser. Before you continue I’d advise you to test if the built in tiled map component displays the graphics correctly under all the circumstances you want it to.

For me it was drawing black edges and artefacts when I used the cc.Camera and zoomed in and out smoothly. If you plan on using animation you should also check if that is correctly supported.

If you do your own parser, like me, then you’ll have full control over all the aspects that you mention. :wink: I was actually pleasantly surprised that performance was great considering how many nodes I was creating for the tiled map.

I actually build my own grid too, but at some point I need to handle 3k hexagons and Im having some performance issues, so thats why Im trying with TMX. I didnt tested the cc.Camera component and I actually do a zoom in/out over the whole map. Do you have some example code on how to work with cameras?

Thanks for the feedback!

Hi @jrosich, @phero_constructs

Go here:

I’m trying to get the camera to follow my player, since I have a 6000 x 6000 world , unfortunately, can’t use cc.follow as you can see from the below post:

God Bless…

Sincerely,

Sunday

1 Like

Great! Thanks!

Hi @jrosich

You’re welcome…God Bless…

Sincerely,

Sunday