Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualfreeworld

Posted 25 January 2013 - 01:22 PM

Would not just be easier to assign all your objects a z or depth value. This can simply be the distance between the object and your camera or car. Then just sort list based on the depth so that farthest away are drawn first. Then all you have to do is call the render function instead of having to iterate through your list for every object.

Ive only played with xna a little. I think my suggestion will require you to keep every object in one list. Hope that helps a little. I can go in more depth when im home.


Also your question why the zombie is always on top. Im going to take a stab in the dark and say your zombie sprite is taller than your debris sprite. And since youre useing the y value as your comparison the zo.bie wins everytime being taller in all.

#1freeworld

Posted 25 January 2013 - 01:20 PM

Would not just be easier to assign all your objects a z or depth value. This can simply be the distance between the object and your camera or car. Then just sort list based on the depth so that farthest away are drawn first. Then all you have to do is call the render function instead of having to iterate through your list for every object.

Ive only played with xna a little. I think my suggestion will require you to keep every object in one list. Hope that helps a little. I can go in more depth when im home.

PARTNERS