this question bugs me for a while now. I am working on a project right now and decided to deal with this when i have to, so I can focus on core-stuff for now. So I wanted to take the time to ... fully understand this matter and find the best solution until then.
Imagine you have a simple tilemap. Nothing too special, its a grass plain and you control a character. And on this grass plain your character can create small forests (in this example consisting of maybe three trees).
The forest-pattern of the trees is always the same so you decided to put the three tree-sprites into one seperate forest.tscn - scene.
What happens now, when spawning the forest is the following:
const forest_scene = preload("PATH")
var new_node = forest_scene.instance()
Now let's assume the maingame is the node of the main scene and is a YSort-Node and the character is also a direct child of the maingame node.
The result would be that if your character moves "behind" the forest (YValue is further at the top) the character disappears behind all three tree sprites. Even if it wouldn't make sense.
What I want to ask you now is if you know any solution to this problem, so that all 4 sprites (character and the three tree sprites) can be sorted seperately, but the forest as a scene could still be used.
Maybe i am thinking of this wrong... maybe the ysort-node is not supposed to be used for this kind of problem... should I write a script that sorts all sprites on _process using the Z-Value?... Maybe one of you guys knows a trick i didn't think of by now!
Thanks in advance! :)