Can anybody help me? Thanks !
use Actions.run
:
Action action = Actions.sequence(
Actions.delay(1f),
Actions.run(new Runnable() {
@Override public void run() {
// end of action
}
})
);
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With