Tiled: can I make the properties of the tileset works by default when added on a map?

Hi.

Sorry for the unclear title, I’m having difficult to explain myself in a few words.

I’m working with Tiled and I’m facing an annoying problem that would be great to fix.

In my tilesed I set a few properties (variables) to any tile I use, in order not to have to set it manually any time I put this tile on a map.

But when I put this tile on a map (in a object layer, I’m not using tile layers), the property I set appears in grey, and it does not appear in the exported file. In order to make it work I have to click on it, change something and press enter. In this case it becomes black and works.

This is very annoying: the tileloader I made in corona requires any object to have a “type” property, plus other variables are needed in order to make physics and other scripts work. It is really frustrating to set it manually to any object I put on a map, when it could be a lot easier to set them in the tileset and have them working for any object.

This is sketch. It show you how copy all properties from tileset to objects.  

for i=1, #layers do     local layer = layers[i]     -- Object Layer?     if layer.objects then         for j=1, #layer.objects do            local object = layer.objects[j]             -- Find tileset based on gid            local tileset = findTileset( object.gid )             if tileset then                 tileset.properties = tileset.properties or {}                 -- Copy properties                 inherit( object, tileset.properties )             end         end     end end

You can find Object Type Editor useful for this task.

ldurniat

Thanks for your answer, I solved :slight_smile:

I didn’t notice that those properties actually appears in the exported file under the “tilesets” table :slight_smile: this because the tileloader I made does not use those informations in order to build the level, so I always ignored this table :slight_smile:

This is sketch. It show you how copy all properties from tileset to objects.  

for i=1, #layers do     local layer = layers[i]     -- Object Layer?     if layer.objects then         for j=1, #layer.objects do            local object = layer.objects[j]             -- Find tileset based on gid            local tileset = findTileset( object.gid )             if tileset then                 tileset.properties = tileset.properties or {}                 -- Copy properties                 inherit( object, tileset.properties )             end         end     end end

You can find Object Type Editor useful for this task.

ldurniat

Thanks for your answer, I solved :slight_smile:

I didn’t notice that those properties actually appears in the exported file under the “tilesets” table :slight_smile: this because the tileloader I made does not use those informations in order to build the level, so I always ignored this table :slight_smile: