Actually, a much better way to do it would be to add the following to every object's step event:
depth=y;
it might actually be -y though, so try both, I could be wrong...
Also, have an image mask (solid black square). To do this effectively, make the canvas the same size as your character's sprite, then fill that box half way from the bottom with a solid color. Make sure to leave a 1 pixel outline of the background color (so, the total image size should be 2 pixels wider and taller). set the origin of the sprite (the mask) to [1,1] instead of [0,0]. use this sprite as your character's mask.