简体   繁体   English

更改libGDX中的屏幕时出现延迟

[英]Delay when changing screen in libGDX

I'm new member in libGDX . 我是libGDX的新成员。 i want delay screen when changing screen Here my code 我想在更换屏幕时延迟屏幕在这里我的代码

myStage.addAction(Actions.sequence(Actions.delay(1), Actions.run(new Runnable() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
                game.setScreen(new GameOverScreen(game,MYSCORE));
            }
        })));

But the game not change the screen which i want. 但游戏不会改变我想要的屏幕。 It stop at current screen . 它停在当前屏幕上。 sorry about my bad languge . 抱歉我的语言不好。 How can I fix it. 我该如何解决呢? thanks all. 谢谢大家。

Depending on when you want it to be done, you need to call: 根据您希望何时完成,您需要致电:

myStage.act();

And an example to get the output your looking for would be: 获取您要查找的输出的示例是:

if(player.isDead()) {
    myStage.act();
}

But note, this is not an effective way to transition screens. 但请注意,这不是转换屏幕的有效方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM