Make a trees leaves y sort always be infront of the character whilst the trunk is able to be behind and Infront of the character with the Y sort extension

Hi, making a top down rpg as my first gdevelop game (I know its ambitious but I’m okay at pixel art and love writing, my only issue was code and that’s why I selected gdevelop sorry the backstory) basically my issue is I want the main character to be in front and behind the trunk of the tree but the leaves always be in front of the character, I use the y sort extension. If anyone knows a solution that would be great! Thanks. (images attached below) **


Maybe create leaves object and trunk object separately. Have an event that sets the leaves z-order = “leaves z-order + player z-order”.
I haven’t used ysort extension myself but I think that should be the gist of it.

Yes, that’s exactly what you do. In addition to this, also change the origins of the leaves and trunk so that they are at the bottom of the image.

Here’s an example, the lower orange dot is the origin:

Tree leaves:

Tree trunk:

1 Like