1
\$\begingroup\$

In my game I use particle effect for various purposes. In that I detect the completion of the particle effect. Basically I want to do something after completion of the particle effect. But the problem is that I didn't able to find the particle effect completion. So any community member please help me.

EDIT : I was creating particle effect using following code

    pointParticleEmtitter = new PointParticleEmitter(pX, pY);

    particleSystem = new ParticleSystem(pointParticleEmtitter, maxRate,
            minRate, maxParticles, mParticleTextureRegion.deepCopy());

    particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
    particleSystem.addParticleInitializer(new ColorInitializer(0f, 0f, 1f));
    particleSystem.addParticleModifier(new AlphaModifier(1, 0, 0, 0.5f));
    particleSystem.addParticleModifier(new ExpireModifier(0.5f));
    gameObject.getScene().attachChild(particleSystem);

Using above code the particle effect was started but when finished that I want to detect. After finishing effect I want to remove the object from the scene.

\$\endgroup\$
4
  • \$\begingroup\$ This question is way too vague, we don't have crystal balls here. What technology are you using? Can you show relevant code? What would you like to do after the particle effect is finished (return to the pool, destroy, start a new effect)? How are you currently trying to detect if a particle effect is finished? \$\endgroup\$ Commented Jun 8, 2012 at 10:57
  • \$\begingroup\$ Thanks for you response, I modified my question as per you say. \$\endgroup\$ Commented Jun 8, 2012 at 11:03
  • \$\begingroup\$ What framework are you using? Some sort of Java + OpenGL thingey? \$\endgroup\$ Commented Jun 8, 2012 at 11:52
  • 1
    \$\begingroup\$ I was using andengine GLES1 that thing was mentioned after the question. \$\endgroup\$ Commented Jun 8, 2012 at 12:16

1 Answer 1

2
\$\begingroup\$

You can add a timer with call back to be called when your particle system is done.

...
particleSystem.addParticleModifier(new ExpireModifier(particleEffectDuration));
gameObject.getScene().attachChild(particleSystem);
scene.registerUpdateHandler(new TimerHandler(particleEffectDuration, new ITimerCallback() {
    @Override
    public void onTimePassed(final TimerHandler pTimerHandler) {
        //code that triggers when timer is complete
    }
});
\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.