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 (104 points)

1 Answer

0 votes
Best answer

Hi,
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,437 points)
selected by

Just for the record, making a script to the table and then converting it into a tilemap wont work, because tilemaps are just one object with collision in its parts... it won't handle other kind of stuff besides collisions, lights, etc.

Hello! Thanks for your answer! Well, if you will read again my question, I did put the tilemap node and the player node under a YSort parent node. like this:

YSort

-Player
-TileMap

And I would think that YSort would automatically sort out the player and the tiles of the tilemap but it doesn't work.

Putting them individually in the YSort parent as a child works though. Maybe YSort does not sort out tilemaps with other nodes under it.

Hi,
I just tried in my pc and works as i said.. can you share me your project to see? I'll send my modification of isometric tutorial

Are you on beta or stable release?

Well I've downloaded the godot engine in Steam and it says there Godot 3.0. Doesn't mention anything about Beta though.

How can I share to you my project? Can I upload it somewhere?

You can upload to drive or mega or whatever cloud service and paste here the link. I shared you a project.. can you see if it works in your pc first?

I've seen the project and unfortunately it's the same result as mine. The troll looked like he stepped on the wall instead of getting behind it (the walls should load in front of the player but it looks like the player is just going over it.)

Here's a public picture of what I mean.

https://ibb.co/NnLHWRb

Don't worry about the link. It's from Imgbb, just a site where you can upload public photos.

So the same project that works in my pc does not in yours? wow, that's strange... maybe you should install a standalone version from godots web? Share me your project and i see if yours works on my pc.

This is how it looks in my pc:

https://ibb.co/H2mcyfD

Okay but I need to arrange the project first because it's quite a mess right now. But can you try moving the troll to the position where I've put it and see if he goes behind the wall because mine didn't. And show me the picture. I will send a link to my project as soon as I arrange it.

I'm sorry... my bad.. i was testing everything in godot 3.1 beta 2... it works fine ther.. but not in 3.0.6 stable release

If you are not in a hurry, may be you should change to 3.1.

Here you have:

https://ibb.co/XjtxMPB

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 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 webmaster@godotengine.org with your username.