Can objects be animated?

DEar Thorbjorn, how about animating objects is it possible? do you have a documentation for it?

@omerfaruk_1 Ah, please don’t resurrect some old topic to ask a new question (I’ve moved this discussion to a new thread now).

You can animate only tiles, but you can place tiles as objects. That way, you’d have an animated object. The documentation is a little light on the subject of defining animations, but there isn’t much to it (also see instructions I wrote above):

1 Like

Hi @bjorn, I would like to ask is there any way to check if a tileset has an animated tile in it. Using json or as tmx version is there any property to differentiate animated tiles. For example in the code shown below only tile id = 0 is animated. Is there anyway to catch it.
Thanks in advance.

What do you mean by “check”? If the tile has an animation, then it’s animated. If it does not, then it’s not animated. In TMX animation is a child node of the tile node (as you can see in your screenshot), and in JSON animation is a property of the tile object within the tiles array.

If you mean in Tiled itself, animated tiles have a little film strip going across the corner.

Hi, Thanks for the response, I need to get which one is animated to retrieve other properties like duration , which tiles are included in the animation. So, I mean get the spesific tile and as you mention in JSON animation should be a property but my question is what is the keyword of animation. I tried mapObject.getProperties().get(“animation”, Boolean.class), but it did not work. I need the keyword to retrieve other properties.

The animation is stored on the tile, not the map object. In the JSON format, you will find an animation property on tile objects, which if set, provides you with an array of frame objects.

So if you want to check if your map object is animated, you first need to determine which tile it is using (which you’d generally have to do anyway if you want to determine how to render the object).

1 Like