[SOLVED]How do I make an object appear behind and infront of an object at the same time?

Sorry if the title doesn’t make sense but I’ll try to explain it to the best I can
I’m creating a top down shooter, and normally the player will always have the highest z order, I want the player to be infron of an object if its below an object and I want the player to be behind the object if the player is above the object, if this is still confusing here let me give a screen shot to better understand what I’m talking about.

Here, as you can see the first pair represents the player being infront of the object when it’s below it, and the 2nd pair the player is now behind the same object when it’s on top of the object.

if there’s a youtube tutorial on how to do this do let me know because I have not been able to find one probably because I dont exactly know the right key words to search for it

Go to behaviors of objects you want to have that gimmick
And look for YSort behavior which will do exactly what you describe

Start watching from 0:48

Oh thank you very much for this, it actually works!