Why are sprites the parent nodes for tiles in tilesets?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mofro
:warning: Old Version Published before Godot 3 was released.

I just spent a long time today trying to figure out why collisions in a tilemap were not working. The issue was that in the tileset scene I had the staticbodies as the parent nodes for each tile, with the sprite and collisionbodies as children.

Is this intended?

:bust_in_silhouette: Reply From: Zylann

I think it was, because Tilemaps are generally used to, at least, display graphical tiles, so Sprites.
Then Sprites can have colliders, light occluders etc but they at least have a Sprite most often, so it was forcibly implemented as if tilemaps were to be used primarily for displaying sprites.

I agree it can be confusing because most of the time, in any interactive game object, the root is physics and location, and visuals are children. It shouldn’t be difficult to modify the TileSet exporter to relax this constraint, however you still have to match only one Sprite per tile (although even that could be worked around).

I never had problems with this so far anyways, but if you do, maybe you can suggest something on Github.

It is definitely confusing, after I figured out the tileset order I thought that was the correct way of doing things and without thinking I went around and changed other interactive objects to match this style, which of course broke my scripts.

mofro | 2016-10-03 13:03