Custom properties to tiles on Tile Layer?

(Tony Fonager) #1

I have been using Tiled for a while, and now I need to add some custom properties to my tiles added to my Tile Layer.

But it is not possible - the tiles added have the static properties defined in the Tileset.

So I suddently discovered the Objects Layer - and started using that, and here I can add/change properties to a tile from the Tileset

But the editor is kinda wierd, probably as it is not meant to be used for adding/setting/removing tiles as on the Tile Layer.

For example i very often find myself not able to remove a Tile from the Objects Layer again - I rightclick, can see that its selected and choose “Remove” but it stays there.

I use MacOS app.

(Thorbjørn Lindeijer) #2

In this case, you’ve probably placed multiple of the same objects on top of each other, which means you’re removing the top-most one, but beneath it you see the next one. On tile layers, each cell can contain a single tile, whereas on object layers you can place any number of objects at the same location.

Depending on your use-case, it may be helpful to use rectangle objects instead of tile objects to annotate your level. You can color them by type (or set a color on the object layer) so you can recognize various purposes.

(Tony Fonager) #3

You where absolutely right. Had 13 similar objects stacked on the same time position :wink:


Cool with objects editor - I have seen where to create the objects and love it, - but how do I insert them on the objects layer ?

(Thorbjørn Lindeijer) #4

Can you elaborate? Creating objects and inserting them sounds like the same thing, so I don’t understand the question.

(Ron) #5

I find that I often create several objects on top of each other. I place the object, then I immediately want to move it and click to select (without changing tools), but it creates a new object and I often don’t notice.

(Tony Fonager) #6

I have found the window “Object Types Editor” where I can add “object tiles”, set a color and a bunch of properties - it feels like exactly the stuff I need, i do not need graphical tiles and have only used them until now, as it was the only types of tiles I know.

So now I know where to create them.

But where / how do I insert them to my tile map ? And which layer are they inserted into ? Layers or Objects Layer ?


(Tony Fonager) #7

I have figured it out now. When you have selected a Tile in the “Objects Layer” you can go to the properties for that tile and there is a “Type” where you can select / choose the predefined “Object Type”.

I just dont know what the color is used for, though ?

And I can only select the “Type” value, when I already have placed a “standard tile” on the objects layer, correct ?

Interesting …

(Tony Fonager) #8

Sp what happens if my object tile already has a property called “Name” and I then choose a “Type” which also has the “Name” property defined ?

As I can see it for now, it does not “override” with the properties from the “Type” object selected.

All my Tiles have a Name property (used when debugging the game), so when i then select a Type called “Moveable enemy” I would like it to override the properties already defined on the Tile.

Is that not possible ?

(Thorbjørn Lindeijer) #9

Right, the object creation tool remains selected to allow easily creating multiple objects, but that means you can’t select objects. If you use a development snapshot rather than Tiled 1.1, then pressing Escape provides a quick way to switch from the object creation tool to the object selection tool. Feel free to suggest additional ways to make this more comfortable.

For tile objects the color is only used for the label, which appears if you set a name on the object (and by default only for selected objects). The color is also used when rendering rectangle, ellipse and polygon objects with that type.

Actually for tile objects there is a feature where you can set the type on the tile and it will be inherited by the tile object (though not saved, unless overridden). See Typed Tiles.

The “name” property only determines what is displayed on the label. It is separate from the “type” property. The name of the type has nothing to do with this name property.

You can override the properties already defined on the tile, but I’m not sure exactly what you are asking here. Maybe the Tile Property Inheritance section in the documentation helps?

(Ron) #10

Only thing I can think of is if you try and place an object exactly on top of another, it will switch to the selection tool and select the object instead. But that might be fraught with issues as well.

(Tony Fonager) #11

Hi Bjørn, thanks for the very detailed answer - I really appreciate it.

It nice that you can use “Typed Tiles” but in my case I first need to apply these “sets of properties” when I have added a tile to the “Objects Layer”.

And right now it works totally as I wished for - but the selection / set tile thing is a bit confusing …

I think the difference, which created the confusion is that when you add tiles on the “Tiles” layer, when you move the pointer around the grid, the current selected tile is visible - so you kinda know if you click, that particular tile will be set - but when you work on the “Objects” layer, even though in “tile mode” you just see the pointer - which is more accepted as a “selection or click” pointer, that a “lets drop a tile here” thing :slight_smile:

Where do I find the latest snapshots ? On the downloads page, the snapshot looks older than the released 1.1.3 version ?

(Thorbjørn Lindeijer) #12

I agree, and there’s an issue open about improving this. It’s an old one, but I’ll try to get around to it sometime soon. See:

Even though indeed the Tiled 1.1.3 release is newer than the snapshot from 2018.03.04, the difference is that 1.1.3 is a maintenance release made from the “1.1” branch whereas the snapshots are built from the “master” branch and include the changes made so far that will eventually make it into Tiled 1.2. This includes some improvements to the object-related tools as described in this development update.

(Thorbjørn Lindeijer) #13

Yeah, I think this would get a little inconsistent. Probably the issue described by @TonyFonager also applies here, since it would make it clearer when you are in “placement mode”, which would reduce the chance of accidentally putting down more objects. Since I’m making some improvements in this area in Tiled 1.2 already, I’ll add it to the roadmap for this release.

(Ron) #14

Yeah, @TonyFonager’s solution (changing the cursor) is much better and would solve my problem.

(Tony Fonager) #15

Got the new version downloaded - and yes, “escape” key when working on object layers is much better. Thanks!

(Tony Fonager) #16

So, I now use the “Object Types Editor” to define custom property groups, and when I get the tile from the Object Layers, I can see that it has the “Type = MoveLeft”.

But where in the map do I find the Object “MoveLeft” which I defined inside the “Object Types Editor” ?

(Thorbjørn Lindeijer) #17

You won’t find a “MoveLeft” object unless you place an object and give it that type in the Properties. It’s just a possible type of object that you define in the Object Types Editor.

If you have a tile that you assigned the “MoveLeft” type to, and place that tile as an object, then when you select this object the custom properties you have defined for that type should be visible in the Properties window.

(Tony Fonager) #18

Sorry, I think I mixed up some definitions.

What I meant was, that I cannot find the properties in the map file - which should be “inherited” from assigning the Object Types selection in the “Type” field.

I see the properties when I am INSIDE your editor - and if I change/override some of the values, they can be found in the map file in the objects collection.

But the values “inherited” from assigned an object type to the “Type” property, is nowhere to be found if left as default.

I have now enhanced my mapload function, to load and deserialize then “ObjectTypes.json” file I manually export, and then assign the “missing” properties to the map, before using it in the game.

So problem solved, for now :wink: