How to detect the end of action in Libgdx(0.9.7) of android

Not sure if this answers your question, but this is one way to simulate an "actions-completed listener":

Action completeAction = new Action(){
    public boolean act( float delta ) {
        // Do your stuff
        return true;
    }
};

Action actions = sequence(fadeIn(1f), fadeOut(1f), completeAction);

(Source: http://steigert.blogspot.com.br/2012/07/13-libgdx-tutorial-libgdx-refactoring.html)


I think that the best approach would be to keep it simple. You could poll if the actor has any action left by using

if (actor.getActions().size > 0) {no actions left!!} 

A good place to place that code would be near the actor.act();

Anyway, you can execute a secuence of actions using a sequenceAction:

import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*; 
...
actor.addAction(sequence(moveTo(200, 100, 2), moveBy(20,30, 3), delay(0.5f), rotateTo(180, 5)));

That would execute those actions one after the other as they finish.

You can check the nightlies documentation for more info here: http://code.google.com/p/libgdx/wiki/scene2d

Is that what you need? (I'm not sure i understood step 4).

If you need something more specific please ask again. You can also take a look at the Actor Class source code to have a better understanding of how actions are handled. https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/scenes/scene2d/Actor.java


libgdx 0.9.7

Action a = new Action();
render(){
   if (a.getTime >= a.getDuration())
      Gdx.app.log("a", "is done");
}

Warning in check action isDone:

while

delayAction.getTime > 0 and (delayAction.getTime < delayAction.getDuration)

then

alpha.getTime > alpha.getDuration

until

delayAction.getTime > delayAction.getDuration.

Example:

AlphaAction alpha = new AlphaAction();
alpha.setAlpha(0.2f);
alpha.setDuration(1);

DelayAction delayAction = new DelayAction();
delayAction.setDuration(1);

SequenceAction sequenceAction = new SequenceAction();
sequenceAction.addAction(alpha);
sequenceAction.addAction(delayAction);

More at http://congdongandroid.vn/