+1 vote

I have been looking all over for a few days now and I can't figure out why the ysort isn't working with my tileset. I'm working on a top down game and I'm trying to get a top cliff ledge working so that it overlaps the player when they walk above it, but the player overlaps it when they walk below it. Easy, I thought. Nothing seems to work. I've even tried other people's solutions and it doesn't work. I'm starting to think my copy of godot is bugged.

These are the methods I've tried:
-One ysort node that the player and cliffs are both in.
-Turn on/off ysort for the cliffs.
-Parent player to tileset.
-Put a second ysort node inside of my main ysort node and put the tileset in it.
-It the player and the tileset in the second ysort node alone.
-Parent player to tileset inside of the second ysort node.
-Rearranged the order of all the objects inside of the main ysort node.

I've probably done even other methods that I didn't list here just because I was desperate to get it working. No amount of googling has done any good.

If anyone knows of some kind of workaround or something I haven't done, please let me know.

For more background that might help give ideas to my problem: I was originally using 3.0 and converted my project to 3.1. I'm on windows 10. I'm using the same tres file for my cliff tileset as I am for my terrain tileset which is correctly behind the player. I've made other objects, such as trees with regular sprite nodes instead of tilesets and they all work fine. I drink too much coffee for my own good. Idk what else to say here. I'm trying to stay positive about this, because it's frustrating me to no end that something so simple isn't working properly no matter what I do.

I don't really want to make each individual cliff piece it's own node, like I did with my trees. I'd much rather use a tileset, but if I can't get the ysort working on tilesets I don't know what else to do.

in Engine by (23 points)

1 Answer

+1 vote

I also can not get y-sorting to work with a tileset and player.

This is on Godot 3.2.1.stable.official - both MacOS and Windows.

Reproducible example at
https://github.com/floybix/godot-tiles-2d

by (16 points)

Finally figured it out: I had to set the TileMap's "Tile Origin" to "Bottom Left" instead of the default "Top Left".

Also, for "single tiles" with a large region, e.g. a tree that covered 3 tiles vertically, I had to add a "tex offset" and "shape offset" (for collision).

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.