如何在actor的操作后执行Java代码?
对我来说,执行一次Java代码非常重要。
答案 0 :(得分:9)
是的,RunnableAction
就是{{3}},您提供Runnable
。您可以通过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));