Fences in 2D Tilemaps: What is my best option?

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

So I am very new to Godot. I started learning the engine earlier last week and I’ve been progressing pretty well. I recently finished my first tileset for a topdown game and after making the tilemap and testing out my character’s movement, I realized that I wanted the character to be able to move behind certain objects on the map. I figured that for certain objects, like trees and bushes, that it would make sense to remove them from the tilemap and have them as separate objects. However, I wasn’t sure what to do about fencing that I want my character to move behind. Is the best option really to make each fencing sprite a static object and piece them together that way or could I layer tile maps to achieve the desired effect? Is there another solution that I am not aware of?

Any advice or help regarding this would be great, thank you!

Im not sure if i understan what you want. You want that for some objects, your character appears to be moving behind, and sometimes in front? If so, what you are looking for is YSort node.

p7f | 2020-09-20 17:40

Is the best option really to make each fencing sprite a static object and piece them together that way or could I layer tile maps to achieve the desired effect?

You can make another tilemap with a bunch of fence tiles. Tilemaps have a ysort property, so you can the character behind and in front of the fence based on their y-position.

exuin | 2020-09-20 18:59

Thank you! I had no idea that was an option with tilemaps, but that sounds exactly like what I’m looking to do.

laurndrsc | 2020-09-20 19:31