How is possible to execute Java code after actor's action?
It's very important for me to execute this Java code once.
Yes, there is RunnableAction
for that, to which you supply a Runnable
. You can queue it via a SequenceAction
.
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
Actor actor = new Image();
actor.addAction(moveTo(10, 20, 0.5f));
RunnableAction run = new RunnableAction();
run.setRunnable(new Runnable() {
@Override
public void run() {
System.out.println("LEEEROOOOOY JEEEEEEENKINS");
}
});
actor.addAction(sequence(moveTo(200, 100, 2), run));