Some help with overlaping mc needed

Hi,

I know it sounds stupid, but I can’t find a way to control object overlaping. In example: Object1 colided with Object2 -> If Objext1y > Object2y then Object2 should go to back, I mean Object1 has to overlap it.
Is there a special action for control of object to be showed in front of other object?
I don’t have a grip of syntax, so I can’t find a way to write a few lines of script… Can you help me?