Help Pausing internal timer
philrocks
Member Posts: 11
i was really hoping for some help .. i am finding it very difficult to make the pause function pause my game timer ??
i have checked everywhere and ill want to do is simply change the internal time when i pause the game and go to the pause screen ??? can anyone help ???
Comments
Are you using a timer behavior or are you using your own timer based off actor.time or game.time?
hi oh man thank you for getting back to me so quick
basically i am using i am using my own game timer
i have a game.pause boolean file .. and have set the pause button to true when i press then it goes to a pause screen from the pause screen i set up an actor - automatically asfter 1 second changes the my time+1 i can see the timer going up ... when u unpause the timer goes back to where it left off
Try This. You need 3 actors, a displayer, pauser, and unpauser. You also need a boolean attribute titled Paused? and an integer titled Time. In the Displayer:
In the Pauser:
In the Unpauser:
Hope this helps!
If your timer is based off game.Time, it'll keep running when the game is paused. If it's based of self.Time, it will pause when you trigger the Pause behaviour.
If you're not using the Pause behaviour, things get a little more complicated.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
thank you so much i am trying it right now
Here's what I do.
I create a game.paused boolean - true when paused, false when not
I also create two reals, a startPauseTime and a PauseTime - both real.
Whatever actor initiates the pause, sets startPauseTime to game.Time
When the game is unpaused, have the actor subtract the game.Time from startPauseTime to get how long the game was paused.
In the actors, created a paused boolean as well. In your pause behaviors, set that to true.
Somewhere you will have a if attribute game.paused = false and then a bunch of code you do. The first line in there should be, if self.paused = true then add startPauseTime to your timer and then set self.paused to false.
Basically, you're keeping track of how long the game was paused and then adding that interval to the timer, which SHOULD keep the timer on track.
wow i rerally osund like a noob am sorry but it doesnt seem to be working anychance of a step by step guide ? so sorry i cant see it anywhere
tried step by step on both accounts and it still wont work is it because i am using pc and when u pause the game u have to change the scene ?
So you are using the built-in pause feature?
hi yes i am i thought id try it out on a blank template before is started messing with the game and followed tigers instructions it didnt seem to work then i tried your and the same again i literally did it step by step i can show you a vid if you like
can you do a steop by step of yours if its possible i am sorry !!
trying to set a count down timer with pause and having major difficulties
absolutly awesome i got the time pausing and going up how do i reverse the process for a count down timer ?
thank you all for your fractured help piecing it together was difficult but i did it if anyone needs help on how to pause and unpause time please reply