yourdeaddreams Posted June 29, 2016 Share Posted June 29, 2016 I'm currently looking at this example: http://phaser.io/examples/v2/tilemaps/blank-tilemap and it leaves me confused: in line #33 the author adds a preloaded image as tileset. I tested this and you can do this multiple times. But only one is the active one, which makes sense. But how do I set the current tileset if I've added multiple ones? Link to comment Share on other sites More sharing options...
drhayes Posted June 30, 2016 Share Posted June 30, 2016 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 More sharing options...
yourdeaddreams Posted June 30, 2016 Author Share Posted June 30, 2016 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 More sharing options...
Recommended Posts