What is the suggested way to use Tiled editing non-tile objects?

I’m the developer of dooDlefense. I’m using Tiled in my new game. I’ve already designed a map, which works great. Thanks a lot for this very convenient tool! :slight_smile:

Now I need to edit some non-tile objects. For example adding different types of enemies with different kinds of properties. Based on my very little knowledge about Tiled, I can think of two ways:

Method 1

Using object layer, and create objects which are smaller than a tile. And add all the properties that you need in the object. In the code using the position of object to calculate its tile coordinates, and read those properties.

cons for the first method:

  • Objects don’t show images, you can’t tell directly at glance what
    enemies you have on the map.

  • Objects have properties like sizes that I don’t need, and for tile coordinates it takes some cpu time to calculate.

  • There would be many reusing of enemy types, however using this way you can only copy the old objects that exists on this map or other maps. What if there’s some properties that you want to change on all of the enemies on a certain type? Updating every objects manually seems certainly is not the right way.

Method 2

Using another tile layer. Creating a new tile set with the enemies’ images that I want to see in Tiled (only used in designing process, won’t use them in real game, the initialization of enemies will be handled by codes according to the information contained in this new layer). Each tile in the new tile set represents a type of enemies, and I can edit its properties in tile set, and it’ll take effect on all other enemies with the same type. In tiles that I want to add enemies, I’ll just paint it’s tile at the right tile coordinates.

It seems to me that the second way is a better one especially considering it’s visible during editing and it’s convenient to modify properties. Is there any other recommended way?

And I have some questions regarding the second way:

1 What is the proper way to iterate all the tiles in one layer? Of course I can iterate all tile coordinates and get its tile GID, but it sounds very inefficient when there’s very few tiles on this layer.

2 The new tile set mentioned in 2nd way must use another image, which is not useful in the real game project. Can I just use the right image during editing in Tiled, however in the Xcode project I add in a 1*1 pixel blank image with the same name of the tile set? Is there more elegant way to do it?

Any suggestions are appreciated, thanks!

You can use tile - objects for that. That basically is a freely placable object which displays with the tile texture.

Well if you have a tile object you simply take the center of an object for example. I do not think that the calculation between the coordinates will create any issue…

You can select multiple objects and change properties on all of them at the same time. This however only works for a single map and not if you want to change it on all of your maps.

With tile objects you have the advantage that you could maybe use the tile properties as “base” properties and the object properties as overrides/special values. Then you can export the tile properties into a tsx file and share that one. But not sure if that is practical for you.

Well you can do this once at load time and then save the result in a list which only contains the actual objects.

I am not sure if i got this right… But if your concern is that you are having the overhead of an complete tileset while you only need the metadata (where the tiles are placed, properties, etc) why not only load that data and do not load the tileset at all?


1 Like

Using tile object seems to me is the answer I’m looking for. :+1: Thanks a lot!

1 Like