0 votes

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?

Godot version 3.2
in Engine by (51 points)

2 Answers

+2 votes

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?

by (8,150 points)

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.

+2 votes

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.

by (39 points)

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!

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.