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!
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!