Help Pausing internal timer

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

  • ookami007ookami007 Member Posts: 581

    Are you using a timer behavior or are you using your own timer based off actor.time or game.time?

  • philrocksphilrocks Member Posts: 11

    hi oh man thank you for getting back to me so quick

    basically i am using i am using my own game timer

  • philrocksphilrocks Member Posts: 11

    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

  • tiger27tiger27 Member Posts: 127
    edited June 2015

    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:

    Display Text Game.Time
    
    
    If Game.Paused? is false
    
    Every 1 second
    Change attribute Game.Time to Game.Time+1
    

    In the Pauser:

    If touch is pressed
    
    Pause Game
    
    Change attribute Game.Paused? to true
    

    In the Unpauser:

    If touch is pressed
    
    Unpause Game
    
    Change Attribute Game.Paused? to false.
    

    Hope this helps!

  • ArmellineArmelline Member, PRO Posts: 5,366

    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.

  • philrocksphilrocks Member Posts: 11

    thank you so much i am trying it right now

  • ookami007ookami007 Member Posts: 581

    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.

  • philrocksphilrocks Member Posts: 11

    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

  • philrocksphilrocks Member Posts: 11

    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 ?

  • ookami007ookami007 Member Posts: 581

    So you are using the built-in pause feature?

  • philrocksphilrocks Member Posts: 11

    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

  • philrocksphilrocks Member Posts: 11

    can you do a steop by step of yours if its possible i am sorry !!

  • philrocksphilrocks Member Posts: 11

    trying to set a count down timer with pause and having major difficulties

  • philrocksphilrocks Member Posts: 11

    absolutly awesome i got the time pausing and going up how do i reverse the process for a count down timer ?

  • philrocksphilrocks Member Posts: 11

    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

Sign In or Register to comment.