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.
问问题
2578 次
1 回答
11
您可以通过以下方式停止Action
s:
actor.removeAction(Action)
用or删除它们actor.clearActions()
- 您可以覆盖该
actor.act(delta)
方法,如果gameOver
已设置,则不要更新Actor
(不要调用super.act()
) - 在
render
don't callact
for thestage
, ifgameOver
中设置
所以基本上s 在 的方法中Action
得到更新。如果您设置为您可以简单地停止更新:act
Actor
gameOver
true
Stage
在渲染中:
if (!gameOver) {
stage.act();
}
stage.draw();
于 2014-04-15T06:01:23.623 回答