I'm currently trying to flip a particle effect (libgdx API). What works great so far: new created particles got flipped correctly because I changed the parameters of the emitter. But I want to flip already existing particles as well.
Created particles are not available outside the ParticleEmitter class, so I decided to copy the code and duplicate the ParticleEmitter class.
So my code looks like this:
ParticleEmitter emitter;
for (int i = 0; i < getEmitters().size; i++) {
emitter = getEmitters().get(i);
// change already existing particles:
Particle[] particles = emitter.getParticles();
boolean[] active = emitter.getActive();
for (int j = 0, n = active.length; j < n; j++) {
if (active[j] == true) {
Particle particle = particles[j];
// Here I have to do something with the particle
}
}
// change emitter parameters for new created particles:
/*
*
* emitter.setValue(...)
*
*/
}
Maybe you have a good idea? Thanks :)