Can tiles in tilemaps have particles?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ondesic

I have added some particles to a few tiles in a scene. I then convert it to a scene to a tileset.
The problem is, even after saving as a tileset, the particles don’t show up when actually using the Tileset on a Tilemap.

Is this not possible?

:bust_in_silhouette: Reply From: kidscancode

This is not possible. Tiles are not nodes - when you convert your scene into a TileSet, it is turned into a resource containing specific information extracted from the setup scene that the TIleMap will use: texture, collision, etc.

Though the tiles are not nodes, You can add nodes to a tile, like shape and collision node and that will become part of the tile, correct? It would be great if particle could be baked in as well.

ondesic | 2018-08-02 20:58

You’re not actually adding those nodes to the tiles, they’re just temporary helpers to create the tileset. The purpose of a tilemap is to gain efficiency by batching together all the sprites and collision shapes into a single draw and collision check. Having scripts or processing happen on individual tiles defeats that purpose.

That said, you can use your tilemap as a reference at runtime for where to spawn Particles2D nodes by using get_used_cells() and looping through it to find a given tile id.

kidscancode | 2018-08-03 02:31