Attach a .png to an object

(Ron) #1

I would love a way to attach a .png to an object. I often have objects that will be rendered on the tilemap and right now they appear in Tiled as a square (being an object). I’d like to be able to attach an image to help me understand what all these things are. They are bigger than a tile, so I can’t use tile images. I can kind of do this with tile layers that are a collection of images, but I’d like to attach the image to an object.

Is there currently a way to do this?

(Thorbjørn Lindeijer) #2

I guess you mean tilesets. Indeed you can do it with an image collection tileset. What is the problem with that?

(Ron) #3

The issue (as far as I understand it) is that if I put a image from a collection of images on a tile layer, it becomes a “tile” to the layer with a tile ID etc. I can’t give it properties, move it to anything but a snapping to a grid, etc. I can give the base image properties as part of the tileset, but not the individual object (since they are not objects) properties.

I need all the flexibility of objects, but just with an image attach to it.

(Thorbjørn Lindeijer) #4

That’s what “tile objects” are for. Just place the tile as an object on an object layer using the “Insert Tile” tool when having an object layer selected.

(Ron) #5

Ah, that is the step I was missing. I didn’t make the leap from using normal tile objects to using the collection of images the same way. It’s a little more cumbersome since the tile object just contains the tile id, which I’ll need to then to look up to get the .png, but that’s all a pre-process step.

Thanks! Keep up the amazing work.

(Thorbjørn Lindeijer) #6

That’s true, though on the upside, doing it this way allows you to associate a lot more data with the object than just a reference to a certain image file. Now the object can have a type and properties based on this tile, it can have collision info and it can be animated. Though granted, this is probably not the approach I would take when rethinking the file and data formats from scratch.

You’re welcome. :slight_smile:

(Ron) #7

This system works perfectly and was 99% of what I was looking for. The only missing thing that keeps it from being 100% perfect is a offset property that visually offsets the image without moving the position on the map. But I’ll happily take the 99%. :slight_smile:

(Thorbjørn Lindeijer) #8

Right, such a property currently only exists for the tileset, affecting all tiles in the tileset. The following issue is about making this possible per-tile: