I would like a few new things: fill object layer and set type on tiles

Could it be possible to have a fill command when placing objects?
And could it be possible to give tiles in the tiles a type, so when placed on object layer it already has a type?

Filling and objects are not exactly best friends, since filling a map with objects could easily mean creating tens of thousands of objects, which would get incredibly inefficient in terms of CPU and memory usage and it would be rather unmanageable in terms of editing. What are you looking for exactly?

You can’t currently make Tiled assign a type to objects automatically, but you could ignore the type property of the object in your game and instead rely on the reference to the tile, to which you can add a custom “type” property.

The way I’m using Tiled in my current game(SpriteKit) I’m reading the tmx and reading the type of the object.
Therefor I making my levels with just the object layer.

One tile I use a lot and it would be nice not have to put in everyone. But instead a fill function could make it a lot easier.

If its not possible I guess I have to continue the old way. And next time use another way to read tmx file.

The way I using Tiled and my game it would be a big help if I could give a tile a type.
Now I put the tiles on the object layer and click to give it a type.

Right, I guess I’m just saying that a generic fill function for tile objects would be an easy way for some people to shoot themselves in the foot. I’d prefer to add scripting support to Tiled, then you could write a small piece of code to place all those objects instead.

I offered you an alternative, did you consider it?

I have not yet tried your alternative, but I’ll take a look.

Thanks.

Okay I tried your alternative, but I cannot use it.
I read the tmx file and parse it as a XML file.

This is where I tried your alternative.
I read the value “Box2” and the coordinates.
The value I made with your suggestion is “tType”, I can’t read the position from that.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="30" height="16" tilewidth="64" tileheight="64" nextobjectid="255">
<tileset firstgid="1" name="cam-tileset" tilewidth="64" tileheight="64" tilecount="400">
<properties>
<property name="tType" value="Concrete"/>
</properties>
<image source="cam-tileset.png" width="1280" height="1280"/>
</tileset>
<objectgroup name="Level">
<object id="1" type="Box2" gid="25" x="0" y="64" width="64" height="64"/>
<object id="2" type="Box2" gid="25" x="1856" y="64" width="64" height="64"/>

It looks to me like you’ve set a tileset property, not a tile property.

The trick is to read in the gid attribute and resolve that to a tile in the tileset, on which you can put your custom property.

When I have placed a tile in the Object layer I go to the property and set Type to ex. Box2.
But I have to do that for every object I put on my map.
I use a 30x16 tile map, so thats a lot of object I must enter the Type for.
I know I can select more than one in the list and change the Type for all of them.

Thats why it would be nice if I could set the type on the tile in the tiles so do not have to do it for every tile I put on the Object layer.

I’m telling you, that you can already assign custom properties to tiles. Just select the tile in the tileset view and use the + button in the Properties view to add a custom “type” property with value “Box2”.

Yes I know but when I do this and save my map I get this:

   <properties>
    <property name="tType" value="Box2"/>
   </properties>

I cannot use this for anything. I can’t se where is located, I can’t see how many there are.
Thats why I put in the type of the object. That way I can read position and type in my game.
I get this:

  <object id="1" type="Box2" gid="25" x="0" y="64" width="64" height="64"/>
  <object id="2" type="Box2" gid="25" x="1856" y="64" width="64" height="64"/>

But maybe I’m misunderstanding what your are saying.
But I cannot get your solution to work in my game.

In the XML elements for your objects, you have an attribute gid="25". This is a global tile ID and you can resolve this to one of the tiles in your tileset. Normally you’re already doing that in order to render the object, but I guess you may be using the value of type to determine how to render it. In any case, if you calculate which tile this ID is pointing at you can then look into the properties of this tile and read out the value of your custom tType property, to figure out what type of object you’re dealing with.

Yes you are right, I can use the gid value.
There is just one thing. When I look at the the ID in Tiled Box2 is 24, but when I look at the tmx file in Xcode I need to check for the value 25, but I can live with that. Its just a matter of making a list with tiles and the ID that is the value for it.

Thanks for you help and I’m sorry if I was a bit difficult to work with.
The gid solution save me a lot of time…

That is because the 24 is the local tile ID within the tileset, which starts counting from 0 for the first tile, whereas the 25 is a global tile ID, where 0 means “empty tile” and 1 is the first tile from the first tileset. This is why your tileset has the attribute firstgid="1". If you had multiple tilesets, the global IDs would keep counting up whereas within each tileset, the tile IDs start counting from 0.