This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

In the Godot Engine demo title "Isometric Game" where you're in a dungeon and your player is a troll, I've noticed that the Player had to be a child of the walls tilemap for its YSort to work. Putting both the tilemap and the Player under a YSort parent node would not have the same results.

Basically the problem with this is that: what if I wanted to add a table in the game and the Player tries to walk behind it, but instead it would like the player is just stepping on the table but when it goes behind the walls, it looks just fine. And this is because the Player's parent is the Wall TIlemap and not the Table TileMap.

I've tried making a table scene and adding an Area2D to it and I've made a script that makes whatever the body that entered to it be a child of the table. Saved that, converted it to a tilemap but it looks like tilemaps don't detect Area2D's so the script wont work.

In my game, I would use a lot of trees and random barrels so setting them up individually would be tiresome and I hope that somebody has a work-around on this problem. Thanks!

in Engine by (105 points)

1 Answer

0 votes
Best answer

You don't need to have every node as child as the other one for ysort to work. There is a special node called YSort, and all childs of that will work as you want. Just add an YSort node to your scene, and then add both character and table as child of it. Remember than ysort will work with the center of the objects, so you will have to put the center ob character and table to their foots.

Please tell me if this works!

by (3,505 points)
selected by

Here you have:

Great! I'll try switching. Thank you so much for fast replies! :D

Hi, you are welcome! If it works, you may selec the answer so it doesnt remain unsolved!

Hello! It does work in 3.1. Looks like just a bug in the earlier versions. All good now. Thanks!

You are welcome!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.