java Libgdx:暂停菜单和暂停状态
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17809867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Libgdx: Pause menu and Pause state
提问by Essa Reba?o
I have a question regarding the pausing/freezing a game while a window/pausemenu will appear at center of the screen. I've already created a pausescreen class which will be called each time the back key is being pressed.
我有一个关于暂停/冻结游戏的问题,同时窗口/暂停菜单将出现在屏幕中央。我已经创建了一个 pausescreen 类,每次按下后退键时都会调用它。
My problem is that I don't know how to freeze or put the game to pause, this becomes a problem because whenever i tried to click on the outsides of the pause window the player could move around.
我的问题是我不知道如何冻结或暂停游戏,这成为一个问题,因为每当我尝试点击暂停窗口的外部时,玩家都可以四处移动。
采纳答案by Pranav008
follow this link . You will find a gameScreen , there they have specified game state which is responsible for pausing and resuming the game. Read it and your problem will be solved.
按照这个链接。你会找到一个 gameScreen ,在那里他们指定了负责暂停和恢复游戏的游戏状态。阅读它,您的问题将得到解决。
回答by pawegio
All you need is to check current game state in render() function. Here is sample solution: libgdx game how to display pause screen when user click on pause icon
您只需要在 render() 函数中检查当前游戏状态。这是示例解决方案:libgdx 游戏如何在用户单击暂停图标时显示暂停屏幕