I am trying to use a particle system/emitter in Slick2D to produce a thrust jet from a space ship. I can get the emitter running continuously without any problem, however I can't get it to run for a fixed duration when I press the thrust key (which I need to do so that it only emits particles when the thrust is active). Note I can get the emitter to run for a fixed duration once when the program starts, but can't get the emitter to restart afterwards. I have variously tried (all attached to the thrust key press):
- disabling/re-enabling the configurable emitter
- resetting the particle system
- resetting the configurable emitter
- resetting the State of the configurable emitter
- replaying the configurable emitter
- running 2 separate emitters and re-adding these to the particle system when turning the jet on
... which either do nothing (no particles) or give a short burst of particles at the start of the program (for the initial emitter length if emitter length is enabled), but then do nothing whenever I press the thrust key. The last option (running 2 emitters) causes the particle system to run out of particles after about 10 seconds.
Is there a way to stop and restart a particle emitter that will give the effect that I want?
Just to cover any initial questions, I have read and re-read the javadocs (which are, as ever, reductive and unhelpful) and have read what I can find on the internet (mainly FrumsNL videos on youtube, which mention but don't cover this case) as well as doing my own trials as per the list above.
Any help gratefully received.