# Problem using Tiled and TexturePacker

**URL:** <https://discourse.mapeditor.org/t/problem-using-tiled-and-texturepacker/1199>\
**Category:** Questions\
**Created:** [March 24, 2016, 3:50pm UTC](https://discourse.mapeditor.org/t/problem-using-tiled-and-texturepacker/1199 "2016-03-24T15:50:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob92](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rob92](https://discourse.mapeditor.org/u/Rob92)\
**Post date:** [March 24, 2016, 3:50pm UTC](https://discourse.mapeditor.org/t/problem-using-tiled-and-texturepacker/1199/1 "2016-03-24T15:50:15Z")

</div>

I am using TexturePacker to pack my sprites into a spritesheet.  
I then use this spritesheet in Tiled to create my map.

However, when I add a sprite to my spritesheet in TexturePacker and then press Ctrl+T in Tiled to update the spritesheet, all the tiles have wrong id’s because the order of tiles on the sheet might have changed.

I know that this is logical but I cannot figure out how to solve this issue without writting a new tile map editor myself which would then read the TexturePacker Xml data.

The only possibility I saw is to use “Collection of Images” then use the source string to look up the tile in the TexturePacker xml in my framework. However, this imposes some ugly rules for me to follow:

1. I have the name but I still dont know on what spritesheet this tile is on, so I need to give the tileset the exact same name as the name of my spritesheet (including extension)
2. I must always place the TMX in the same folder as the spritesheet (since I cannot specify a relative path in tiled)

Does anyone have a suggestion on how to deal with this?

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [March 24, 2016, 8:09pm UTC](https://discourse.mapeditor.org/t/problem-using-tiled-and-texturepacker/1199/2 "2016-03-24T20:09:50Z")

</div>

> [@Rob92](#):
>
> 1. I have the name but I still dont know on what spritesheet this tile is on, so I need to give the tileset the exact same name as the name of my spritesheet (including extension)

This is a matter of maintaining a simple static index mapping file names to their respective texture atlas. Usually it’s something you are doing already anyway when using texture packing.

> [@Rob92](#):
>
> 1. I must always place the TMX in the same folder as the spritesheet (since I cannot specify a relative path in tiled)

I don’t understand this requirement. Surely you can modify the relative path as needed to allow for the texture lookup?

See also this discussion:

> **[Best way to use Tiled with texture packer/custom game engine?](https://discourse.mapeditor.org/t/best-way-to-use-tiled-with-texture-packer-custom-game-engine/361)**
>
> Hello, I am looking to use Tiled to create the simplest tile based game where assets come from a sprite sheet created using TexturePacker (https://www.codeandweb.com/texturepacker). The game is made up of 64x64 tiles, with some objects (coins)...

---

<div class="post-metadata">

**Author:** ![Rob92](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rob92](https://discourse.mapeditor.org/u/Rob92)\
**Post date:** [March 24, 2016, 8:54pm UTC](https://discourse.mapeditor.org/t/problem-using-tiled-and-texturepacker/1199/3 "2016-03-24T20:54:25Z")

</div>

Oh you mean, I iterate through all the xml files from TexturePacker and look if my tile is in there and then I have all the info I need from that xml.

That could actually work I didnt think of that.
