Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 en.wikipedia.org/wiki/State_pattern. 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.