I always thought a loop that sorted by .y AND 'fake height' would do it
I tried sorting by .y + fake height multiplied by an adjustment constant, and it didn't work.
Reading around I found out too that perspective 2D games are a kind of black art.
My status so far: game sorts perfectly if everything is resting on the floor
I found out that the sorting problems are related to object size. If all objects are the same size (as with isometric tiles) sorting by .y is enough to get it right, always.
So... I might end up doing that. I still haven't tried it out.
I do not use the physics plugin, as my method works a lot with collision masks to simplify the object creation process (they're single sprites with a special collision mask).
I remember checking that example out, but the amount of objects and stuff kinda confuses me XD
Quazi: I tried measuring distance and it didn't work either. The issue is size.
In your diagram, think of 1 as really flat and horizontally long, and then put it very close to 2 and 3. Now measure the distances... you have to pick a point to measure the distance. You'll find out that depending on the point you pick to measure, the closest object can be 1, 2 or 3. :S
Edit:
Kaos: yeah heheh no bounds... I guess I could set up a rect to stay in, as most games will use something like that. Also I'm thinking about setting a floor, specialy if one ends up using regular tiles, so you can cheat with the floor and avoid placing a jillion tiles there.