How should I sort images in an isometric game so that they appear in the correct order?

Posted by Andrew on Game Development See other posts from Game Development or by Andrew
Published on 2011-02-05T05:08:01Z Indexed on 2012/06/30 21:26 UTC
Read the original article Hit count: 240

Filed under:
|
|
|
|

This seems like a rather simple problem but I am having a lot of difficulty with it. What should I do to properly sort images in an isometric game?

In a normal 2d top-down game one could use the screen y axis to sort the images. In this example the trees are properly sorted but the isometric walls are not.

Example image: sorted by screen y

Wall2 is one pixel below wall1 therefore it is drawn after wall1.

If I sort by the isometric y axis the walls appear in the correct order but the trees do not.

Example image: sorted by isometric y

© Game Development or respective owner

Related posts about math

Related posts about JavaScript