stop or break an action in libGDX Scene2D
action, actor, java, libgdx, scene2d
Solution
You can stop `Action`s by:
- removing them with `actor.removeAction(Action)` or `actor.clearActions()`
- you can override the `actor.act(delta)` method, and if `gameOver` is set don't update the `Actor` (don't call `super.act()`)
- In the `render` don't call `act` for the `stage`, if `gameOver` is set
So basicly the `Action`s get updated in the `act` method of `Actor`. If your `gameOver` is set to `true` you can simply stop the `Stage` from updating:
In Render:
if (!gameOver) {
stage.act();
}
stage.draw();
Problem
Is there any way that a can stop an action where it is before it is completed in libGDX Scene2D. I have an actor that is in the middle of a moveTo action but when i set a boolean gameOver to true I want the actor to stop where it is. How would I do that? It seems simple but I cant figure it out.