Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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.

share|improve this question
Basically, inside your game loop you need to check if you are in pause mode, and if so, don't handle input (except for your pause menu of course) and don't update the world. – Christian Jul 23 '13 at 15:05
The pause function in a game is a typical use case for the Whether you implement a pause function as multiple gamestates, e.g. one for ingame, one for pause, or just a single boolean flag indicating the pause being toogled is up to you. – sarahm Jul 23 '13 at 16:19
correct if im wrong dear sirs. I have declared state as int and for my gamestates i have declared gamepaused = 0, and gameunpause=1. after this i've create an two methods. updaterunning which will all my rendering and controls while updatepaused will contain my setscreen for pausewindow to show. is this correct?the problem that i have encountered here is that my gamescreen still doesn't freeze while my pause window is visible. – badasskitteh Jul 23 '13 at 18:09
Are you using canvas or openGL? How about some code? – Justin Aug 5 '13 at 2:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.