【问题标题】:How can I stop the a jMonkeyEngine game?如何停止 jMonkeyEngine 游戏?
【发布时间】:2016-12-18 18:11:28
【问题描述】:

如果2个值大于3,我想退出游戏。我想在这里输入:

        if(player.getWorldTranslation().y > 3){
            if(player.getWorldTranslation().z > 3){
                 
            }

我猜它在文档中,但在搜索 10 分钟后我仍然找不到任何答案。 感谢您的帮助!

【问题讨论】:

标签: java jmonkeyengine


【解决方案1】:

我认为,最好的(如果您需要停止游戏而不是程序):

static Main app;//Put the app variable global and static
...

public static void main(String[] args) {
   app = new Main();
   app.start();
}
...

if(player.getWorldTranslation().y > 3){
    if(player.getWorldTranslation().z > 3){
        app.Stop(1);
        //System.exit(1);//if you need close the entire program;
    }

【讨论】:

  • 应该是app.stop(1);
【解决方案2】:

Here's 退出游戏的链接。你也可以使用System.exit(int)。无论哪种方式都有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多