UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: kevin on June 03, 2012, 02:23:38 AM

Title: Vertical Sprite Depth Ordering
Post by: kevin on June 03, 2012, 02:23:38 AM
  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
Title: Re: Vertical Sprite Depth Ordering
Post by: ATLUS on June 03, 2012, 07:00:07 AM
i like it =) Thx, Kevin!