Main Menu

Vertical Sprite Depth Ordering

Started by kevin, June 03, 2012, 02:23:38 AM

Previous topic - Next topic

kevin

  Vertical Sprite Depth Ordering

          This example breaks away from the concept that depth is straight into the screen.  In fact, Sprite Depth/ Scene Depth are just a sort order keys for the object.   We can set the depth key to anything we like (0 to $ffff).   Here i'm creating a scene where the sprites drawn vertically sorted upon their Y values.  

        To do this, we're using the sprites screen position on the Y axis, and inverting it for our depth value.   We need to invert the value as the sorting engine draws things in highest to lowest.    So smaller z values are drawn after higher ones.  

        What this means is that characters further down the screen (represented as some coloured ellipses) are drawn after characters above them.   So foreground characters can appear to walk in front of other characters.


 Video

 



 Download

ATLUS