Question

I need some idea on how to or some code example or anything related to this.

I have made some particle system, well here i will show from example of nicolas

final SpriteParticleSystem particleSystem = new SpriteParticleSystem(new PointParticleEmitter(-32, ParticleSystemNexusExample.CAMERA_HEIGHT - 32),
                                                                     ParticleSystemNexusExample.RATE_MIN, 
                                                                     ParticleSystemNexusExample.RATE_MAX, 
                                                                     ParticleSystemNexusExample.PARTICLES_MAX, 
                                                                     this.mParticleTextureRegion, this.getVertexBufferObjectManager());  

What i need is to "LIVE" update the variable

private static final float RATE_MIN = 5;
private static final float RATE_MAX = 8;
private static int PARTICLES_MAX = 16;

Here is the the var from previous code

ParticleSystemNexusExample.RATE_MIN
ParticleSystemNexusExample.RATE_MAX
ParticleSystemNexusExample.PARTICLES_MAX

Is it possbile on some way? Is possible to restart somehow particle system. Well restarting it isnt 100% "live" update the system but i need to stay in app like using Settings and when u exit settings it will get new variables.

Basicly i have onCreateScene the ParticleSystem();

i use public void ParticleSystem() {}

And is possible to restart it?

Was it helpful?

Solution

It is not quite clear what exactly you want to do, however Nicholas kept the min and max rate variables private on ParticleSystem class. I'm not sure what behavior you can get, but you can try to add a public interface for that and update it on real time to see what happens. If you don't want to mess with AndEngine platform code, here is a suggestion:

You can create two or more particle systems with different rates and manage them on screen according to your needs. If you you just want to swap them one time, simply detach the first and attach the second one. If you want to keep changing between them, you can use setParticlesSpawnEnabled to determine which one is active.

Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top