I've been trying to make some fire particle emitter with libGDX.
I downloaded an example (http://pastebin.com/cNWs0tt1#). It looks fine, but it eventually ends (the fire extinguishes) and then starts over. I see in the file that is says the duration is 60000ms. So they relied on putting a high number.
Well, that's lame. I tried putting a duration of 0, which of course doesn't work as it just keeps on dying over and over.
So how can I make a particle emitter with unlimited duration?
You can set the continous
-flag to true, the effect will start over and over again.
In the editor:
Or in the source-file:
- Options -
attached: false
continuous: true <----------------------------
aligned: false
additive: true
behind: false
I found a simple workaround for what you are trying to accomplish.
effect.findEmitter("youremitter").durationTimer = 0;
If you call this each time the effect is being rendered, you can reset each emitter to it's starting duration timer. I have tested it and it seems to work very nicely.
Do note however that you need to call this line for each one of your emitters. For example, if you have a rocket ship with a flame/smoke particle effect, you should do this.
public void render(float delta) {
effect.findEmitter("fire").durationTimer = 0;
effect.findEmitter("smoke").durationTimer = 0;
// Render your particle effect here
}
I hope this helps, good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With