Ysort and tile map

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

Hi!

Im really new to Godot and I’m not sure how to do this.

Basically, I’m making a top down RPG game. But, my player is unable to go behind my tree(which is part of my tile map). Im not sure how to tackle this issue of getting the player to go in front of the tree and behind the tree.

I used y sort but it doesn’t work

my z index is 1 for both tile map and player

how should I do this?
Thanks for helping

Your image isn’t working (it’s linked to your local system). It needs to be uploaded to a web-accessible location and then linked here to work properly.

jgodfrey | 2023-03-07 03:44

okie where is there a web accesible location?

GodotUser21 | 2023-03-07 03:46

Google Drive, OneDrive, Dropbox, Imgur, Box, iDrive, or similar should work.

jgodfrey | 2023-03-07 03:56

:bust_in_silhouette: Reply From: zhyrin

Can’t view your image, it requests sign-in.

Anyway, if your tree is part of a tilemap, the tree will be sorted together with the whole tilemap. If you want your map to be behind everything else, but your player and trees work in a y sort, you should have your tree separate from your tilemap.

I have 2 different tilemaps in my image. One for collidable objects and 1 for non-collidable objects under a node 2d

node 2d
-tilemapground
-y-sort
-player(kinematicbody2d)
-tilemapcolision

do I still need to separate my tree from my tilemap?

GodotUser21 | 2023-03-07 23:14

The tilemap with only collidables still gets considered in it’s entirety for the purposes of y sorting. Try walking to the very bottom of it and see if your player can get in front of it, walk to the top end of if and see if the player can walk behind it.

zhyrin | 2023-03-08 07:03

Have you tried using cell_y_sort = true in your tilemap?
I’m not sure it would have your desired outcome.

zhyrin | 2023-03-08 07:07

my player can walk infront of it but not behind it

GodotUser21 | 2023-03-08 23:09

it doesnt work

GodotUser21 | 2023-03-08 23:14