Issue with Y-Sort

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

Hello I am having an issue with y-sort and my player character. It doesnt seem to update the y-sort location for my player character. If I start the scene with a sprite lower than my player then that sprite is always drawn on top of the player and if I start the sprite above my player then it is always drawn below the player no matter how the player moves.

Does anyone know what I am doing wrong?

:bust_in_silhouette: Reply From: exuin

Y-sort is enabled, right?

If it is, are you sure you’re moving the player not just the sprite? Can we see your node hierarchy?

Thanks, I think you might be right with the sprite not moving only the image of the player moving. I took a screenshot of the node structure but I cannot seem to upload it here.

I had a print in the characters script and this updated with new positions but when I created a test scene with just a y-sort and a few sprites and told the script attached to y-sort to print the players position continuously it didnt move from the starting location.

I am still not sure how to fix it but thanks I think at least this is pointing in the right direction.

YuleTide | 2022-11-08 13:24

:bust_in_silhouette: Reply From: senkai

This problem might also be caused by the position of your objects in their root scenes not being (0,0).

Please let us see your node configuration.

Thanks I had actually thought of that and had experimented but that wasnt the problem. I think for some reason even though the sprite on screen is moving the global position of the player is not. It might be because the top node is a node2d with the kinematic node underneath this? I am not sure. Thanks for trying to help though!

YuleTide | 2022-11-08 13:25