To create a pause game function
Hi there,
Let say I'm developing a widget game for Symbian^3, and this game is actually a fast pace object falling down game.(Sometimes more than 1 objects can fall together) So what's is the simplest yet effective way to create a pause function for such a game?
Thank you in advance.
Re: To create a pause game function
that depends on your game logic. maybe it's sufficient to set a bool "moving" which is set to false when paused. in your code, you check the state of "moving" and move the objects only if true.
Re: To create a pause game function
The simplest and most effective way to create a pause is to stop the timer.
Re: To create a pause game function
Wysota I'm not clear what you mean by stop the timer. Is it to stop the timer which control the object to fall down or is there some internal timer which I do not know of. Please enlighten me. :confused:
Re: To create a pause game function
Stop the timer that you have that controls the game loop.
Re: To create a pause game function
But isn't stopping the QTimer will literally stop the timer which makes resuming the game can be pretty ugly because the QTimer will restart the interval again upon resuming.
Re: To create a pause game function
I wouldn't have thought it was be noticable.
After all, you would execute the game loop once per timer event, so stopping and then restarting the timer would have no real drawback.
Re: To create a pause game function
You can always stop the timer from within the method executed as a result of the timer's timeout. Or you can calculate how much time is left till the next timeout and correct the interval while resuming the game. But I think it doesn't matter if the game loop triggers 10ms or 9ms after unpausing the game.