Draw particles at specific layer depths?

In my 2D game, I have Monogame.Extended.Particles for different effects and sometimes sprites are “deeper” in the game than others and I’d like the particle effects belonging to each sprite to draw at their specific depth as well. No matter when I trigger particles or draw them, I haven’t seen any method to do this.

(FYI: using MG 3.6 and MG.Extended 0.6.377)

Any suggestions?

Spritebatch’s draw method has an overload to draw at a specified layerdepth

But then you have to remember to set the spritesort mode to something that actually sorts, right?

SpriteBatch.Begin (SpriteSortMode, BlendState)
https://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.spritesortmode.aspx

for example BackToFront

Using the layerDepth in SpriteBatch it would be easy to add depth to particles and have modifiers for it. You might want to open an issue on the MG.E GitHub page to request this.

Same problem as here. More or less…

Thanks for the replies everyone. I’ve actually created an issue for this in Monogame.Extended on github and may submit a pull request since I got it working last night.

1 Like