I tried different. I compared the Y, if it's bigger then "Move to front", if it's smaller "move behind". It will be a bit complicated if there are many objects, but it's working well.
Another thing,I'm using the 8 direction behavior. How can I simulate a jump? The behavior has 8 directions and works well, but how can I pressing a button (jump button) can do the player go up on Y and after go back to the original Y? When it does it it can call a jump animation for example.