Changing the sorting when player jumping.

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

I am using YSort node to sort objects in the scene.It is working good.

But when my character jumping , it showing the character behind the other objects because y cordinate decreasing.

What should i do to keep my characters depth same when jumping?

When jumping on a top-down game, perhaps its better to offset the sprites/collisions instead of moving the whole body. That way the position is still the same. Try changint sprite offset.

p7f | 2020-08-01 19:34

İnstead using YSort node, i used z_index = position.y for all objects.
For player i made a temporary variable which store y position before jump and using this variable as a z_index while jumping.It is worked fine.Is this solution okay to use?

mrti14 | 2020-08-01 20:01

If it works, sure! why not? as far as i know, using ysort is very similar to that.

p7f | 2020-08-01 20:13