Jump to content

A map can have multiple tilesets. But how do I change the current one?


yourdeaddreams
 Share

Recommended Posts

What do you mean by "only one is the active one"? Are you trying to make a tilemap editor like the one in the example? It's based pretty heavily on how Tiled, the map editor, stores its tilesets. It numbers each tile (starting with 1) for every tileset. So if you have 16 tiles in the first tileset, and 16 tiles in the next, tile index 17 would be in the second tileset. I haven't tried this, but if you added multiple tilesets I wonder if you could just increment the index you pass to putTile?

Link to comment
Share on other sites

drhayes thank you for answering.

 

Yes I am trying to make an editor.

In the example, the author adds one tileset to his map in line #33. Let's assume I add another three tilesets named tiles001, tiles002, tiles003. Let's further assume I'm done with creating the ground layer (layer1) which I painted with the ground tileset (ground_1x1). Now I want to go to the next layer (layer2) and paint with the tiles from tiles001. The example already has the code for switching the currentLayer to layer2, but how do I tell him to now paint with tileset tiles001?

 

//EDIT: As mentioned by @drhayes switchting between tilesets with the tileIndex ("currentTile" in the example code) does NOT work. It wouldn't be good anyways since all your tilesets then would need to have the same amount of tiles.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...