Layering Particles under Sprites (LibGDX)

How do I layer particles under a sprite, such that the sprite will overlap the particles?

I have a ParticleEmitter object that I’m using which blow smoke, as an exhaust from my vehicle. I am trying to layer this under my vehicle, which is a Texture being drawn out as a Batch. Is there any way I can layer the effects from the ParticleEmitter so they are under my vehicle, instead of overlapping?

If this is no possible, are there any work-arounds to layering particle effects?

Depending on how it works, you could just make sure you render the particles first, then the sprites. And if you want some particles over your sprites again just render them after the sprites.

I would expect the same thing.

I wish this was the case but it doesn’t work. I understand that you can do this with batch.draw(), where the order of draw()'s will indicated the layers. However the ParticleEmitter is not part of the batch, and to start the animation you simply effect.start() within your render method.

effect.start();
batch.draw();

and

batch.draw();
effect.start();

The ordering does not seem to make a difference as the particle is always on top of the batch.

SOLVED:

Silly mistake… I was confusing effect.start() with being the sole reason the effect was starting. This is similar to what I had:

render() {
   effect.start();
   batch.begin);
   background.draw();
   ...
   batch.end();
{

However I needed this…

render() {
   effect.start();
   batch.begin);
   background.draw();
   effect.draw()
   ...
   batch.end();
{

You can start a line with two @ symbols and it will be highlighted in the code for you. Bold tags will not work.


this is a normal line
@@but this is highlighted
and this is another normal line.