4 Replies - 2690 Views - Last Post: 06 December 2011 - 04:05 PM

#1 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

2D Sprite Depth

Posted 06 December 2011 - 01:04 AM

I've been trying to figure out a way to control the draw depth of certain 2D sprite layers in my games. I've read that one option is to use SpriteSortMode BackToFront specifying a layerDepth for each texture. Apparently doing this doesn't really allow the SpriteBatch to do it's job though. (from this article) The only other method I could think of would be to iterate through all entities multiple times, each time drawing only any entities of the correct depth. That seems way too costly to me. Has anyone found a better way to control the order in which sprites are drawn?

Is This A Good Question/Topic? 0
  • +

Replies To: 2D Sprite Depth

#2 ShadowsEdge19  Icon User is offline

  • D.I.C Addict

Reputation: 142
  • View blog
  • Posts: 664
  • Joined: 16-January 10

Re: 2D Sprite Depth

Posted 06 December 2011 - 03:07 AM

I have messed around with Draw Orders in an example project I was working on to draw Primitives, I only got around to drawing random sized Rectangles but I did get a working drag and drop style control that manipulated the current draw order of the shape making it draw the shape with the lowest numbered draw order last so that it appeared on top of every other shape. I can share this with you later if you wanted to have a look as I haven't got access to it atm.
Was This Post Helpful? 0
  • +
  • -

#3 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: 2D Sprite Depth

Posted 06 December 2011 - 03:34 AM

I'd love to take a look at it, thanks. I'm creating a drag and drop solitaire game so it should be pretty helpful to check out.
Was This Post Helpful? 0
  • +
  • -

#4 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: 2D Sprite Depth

Posted 06 December 2011 - 06:13 AM

This article might be helpful in using layered sprites.
Was This Post Helpful? 0
  • +
  • -

#5 ShadowsEdge19  Icon User is offline

  • D.I.C Addict

Reputation: 142
  • View blog
  • Posts: 664
  • Joined: 16-January 10

Re: 2D Sprite Depth

Posted 06 December 2011 - 04:05 PM

My Primitives Library Project
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1