I'm sorry I posted this topic twice but I really want help.
I'm trying to make a rpg, but I can't get the zorder right.

I want to get this effect:


I know how to do the collision-thing but maybe I gotta change that to combine it with the Zorder-thing.
Can someone please give me an example-code for an rpg-engine that can do this?