#Building system, how to approach connected objects like fences?

1 messages · Page 1 of 1 (latest)

gentle heart
#

I made a basic building system for my top-down 2d game where the player can place objects from their inventory on the map. These objects are placed inside a Node2D with Ysort turned on. However, I'm not sure how to handle objects that change sprite depending on what's placed in adjacent tiles, such as fences or walls.

What would be the best approach for this kind of thing? Should I go with my existing approach and add a function to detect what's around them in 4 directions, and change the sprite based on that? Or should I use tilemaplayers? I haven't tried them much so I'm not sure how they work. Would I need a separate tilemaplayer node for each type/color of fence/wall/etc or would a single one work? Would they even work properly if the object is taller than one tile?

Thank you.

lean ferry
#

Visually, if you're using a TileMapLayer, you can use auto-tiling to make them change their sprites automatically.