Pause and unpause Timer
MazeCrazeGame
Member Posts: 56
In your Tshirtbooth videos, he says that using the pause and unpause button paused the ENTIRE scene. Well, if you notice on his video, the timer freezes and never resumes. In my game, the game pauses, but actually keeps running in the background. When I press the unpause button, what was once 5secs now becomes the time between pause and unpause. So, if a person paused the game at 5secs (then leaves for 20secs) the game resumes at 25 secs. How do I fix this? If the pause game feature doesn't pause the entire scene simply to skip to a "pause" scene, that's CHEAP! Please help.
Comments
So then i got to thinking, the game time is supposed to tell you the time your in the game, so even if its pause that doesnt change how long your actually in the game so maybe thats why. So i did another test, made my own attribute, had a timer every 1 second change attribute to attribute +1 and put a button to pause the game that also displayed that attribute i was adding to. And after pausing the game that attribute still kept adding as well, so there might be issues with the pause behavior currently.
What tshirt kindly made for you will get you going though
cheers
Pause Game (Go to Scene: Level Completed)
Log debugging statement "after pause game"
Change Scene (Go to Scene: Next scene)
Log debugging statement "after change scene"
*Inline images appear to be disabled on this area of the forums, but here's the screen capture: http://img197.imageshack.us/img197/7462/screenshot20120123at344.jpg.
I expect that when Level 1 is over, the Level Completed scene will appear with the continue button and then when I click the continue button, it should unpause the game and immediately go to Level 2. But instead, it just unpauses the game (so if I completed level 1, I am still on level 1 after it unpauses).
The log shows the two debugging statements immediately (either exactly with or right before the Level Completed scene appears). When the game is paused and I haven't yet clicked the continue button, both debugging statements have already appeared in the debugger window. So basically, it is running the behaviors after the pause game behavior before I unpause the game, but it is skipping the change scene behavior both before and after unpausing the game. Why is this?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
so i will create a game boolean call pause.
i add this in the timer rule>
every 1 sec if pause is false timer = timer+1
so when i use the scene pause rule i will also change game.pause to true when pause is pressed.
This will stop timer from continuing to count when game is paused.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If you have When game.pause is false --> timer every 0.1 seconds change game.theTime to game.theTime+0.1 and you use either a DisplayText actor or a custom actor based on game.theTime, I would think it would be the same general set up for both.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User