countdown timer with pause

inflameinflame Member Posts: 11
edited April 2012 in Working with GS (Mac)
Hi,

I want to pause countdown timer based on this template
http://arcade.gamesalad.com/game/3661

When I touch button for 30 min countdown it starts countdown but when I touch created pause button it stops the time
and when unpause it won't start from the time when pause button is pressed.

Has anyone used this template before with pause button?

Any help needed.



Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    How are you pausing the timer? Are you using a Pause Game behavior?

    When you unpause the timer, what time does it start at?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • inflameinflame Member Posts: 11
    I created an actor called pause. In game attributes I created integer paused.
    In pause actor I created a rule - when touch is pressed, change attribute game.paused to
    (game.paused+1)%2.
    I used this template
    http://arcade.gamesalad.com/game/3661
    and in each number I added attribute game.paused=0. So when I touch actor pause in game
    it pauses game and timer stops but it is still counting.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Okay, I think I understand how you're trying to pause it. Can you post a link to the file you're working on?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • inflameinflame Member Posts: 11
    sorry for delay. Thx for the answer. Here is my gamesalad file i created.
    http://www.mediafire.com/?sww2n3s29223o4e
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If you want to pause the time in a game, you have to use a separate attribute rather than game.time which ALWAYS counts up. So you could change attribute game.elapsed time (real) to game.time when the "press for countdown" button is pressed and then display and pause game.elapsed time instead of game.time.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • inflameinflame Member Posts: 11
    In actor press for countdown I change attribute game.elapsedTime to game.Time. Do I have to change attribute game.elapsedTime with game.Time in all my countdown numbers. What do I put in actor pause button?
  • inflameinflame Member Posts: 11
    Can you please send me file on mail (torque1000@gmail.com) if you managed to get it work.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Yes, you would have to replace game.Time with game.elapsedTime in all of your countdown numbers. The pause button rules shouldn't have to change because they don't involve time at all... they just change a boolean attribute.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • inflameinflame Member Posts: 11
    Ok i replaced game.time with game.elapsedtime and still don't work.When Contdown button is pressed timer won't start it shows number 11 and stops.

    Maybe I need to put something in press for countdown button?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2012
    I think if you're having trouble with that template, you may want to start with something a bit easier. You can make a countdown timer using the Display Text behavior and an integer attribute (game.timer, and also integer game.paused). Just make an actor with the following rules:

    Change Attribute game.timer to 10

    Rule When attribute game.paused is 0
    _____Timer every 1 seconds
    __________Change Attribute game.timer to game.timer - 1

    Rule When Touch is Pressed
    _____Change Attribute game.paused to (game.paused+1)%2

    Display Text game.timer

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • inflameinflame Member Posts: 11
    I finally did it. Thx very much for help:-))
  • inflameinflame Member Posts: 11
    thnx tshirtbooth for demo!
Sign In or Register to comment.