Need help with timer

MazeCrazeGameMazeCrazeGame Member Posts: 56
edited January 2012 in Working with GS (Mac)
Merry Christmas CM
You seem to know your GS well. I need help w/timer
• I have a maze game with several levels. It's simple...ball goes into a hole.
• I need a timer for each level to show how long it took a person to finish each level
• The timer will be displayed AFTER each level is completed showing how long it took a player to finish.
• Once the ball goes into the hole the timer will stop, then display how long it took (I don't want the timer to appear as each level is being played)
• No highscores. No "your" time. No "best" time.
• The timer will reset itself when a player leaves the scene
Hope that makes sense.
I'm really close to launching the game and I'm excited.

Merry Christmas again.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    youll need 2 attributes . One boolean and one interger. Call the boolean Scene1TimerOn (or whatever scene namne it is) and have it set to false, and call the interger Scene1Time and have it set to 0.

    Make a rule whenever you press the play button in the scene or whenever you start the scene( if the scene starts automatically when you get to it just have this behavior by itself)

    change attribute scene1TimerOn to true

    then make another rule when attribute scene1TimerOn=true
    Put a timer every 1 second inside that rule,
    and put a change attribute behavior inside that timer change attribute scene1Time to scene1Time+1

    now whenever you want the timer to stop counting( in your case when the balls in the hole so ill use that as an example) change attibute Scene1TimerOn to false

    so in your case you would have a rule when actor ball collides with hole, change attribute Scene1TimerOn to false.

    Then whenever you want to display the time simply have a display text behavior and display attribute Scene1Time

    then whenever you want to reset the time have a change attribute behavior and change attribute Scene1Time to 0

    cheers
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    @jrdi2010
    Posting in @codemonkeys corner won't make him reply... i haven't seen him in the forum for ages!!
    Where are you @Codemonkey ??
  • MazeCrazeGameMazeCrazeGame Member Posts: 56
    Thank u so much
    I will try this and get back to u
  • jckmcgrawjckmcgraw Member Posts: 647
    Boolean attributes are my best friend! :P So simply yet so useful.
  • MazeCrazeGameMazeCrazeGame Member Posts: 56
    Something isn't right because its not working.
    Let me clarify...
    • Each scene has a different ball going into the same hole.
    • Am I creating an actor (timer) then applying these rules and adding it to each scene?
    • OR, am i applying your tips to each scene?

    I made the two attributes (boolean & integer)
    Then you wrote:
    Make a rule whenever you press the play button in the scene or whenever you start the scene( if the scene starts automatically when you get to it just have this behavior by itself)
    • Yes, scenes start automatically, so where do I make a rule?
    • When you say leave behavior by itself, what does that mean?

    change attribute scene1TimerOn to true
    • Is this a stand alone rule?
    ----------

    then make another rule when attribute scene1TimerOn=true
    Put a timer every 1 second inside that rule,
    and put a change attribute behavior inside that timer change attribute scene1Time to scene1Time+1
    • Again, it makes sense but I'm not sure if I apply this to a timer actor or scene
    ----------

    now whenever you want the timer to stop counting( in your case when the balls in the hole so ill use that as an example) change attibute Scene1TimerOn to false


    so in your case you would have a rule when actor ball collides with hole, change attribute Scene1TimerOn to false.
    • is this a separate rule?
    Then whenever you want to display the time simply have a display text behavior and display attribute Scene1Time
    • does this go into the rule above?
    then whenever you want to reset the time have a change attribute behavior and change attribute Scene1Time to 0
    • does this go into the rule above?
    I appreciate your help. Don't feel offended if you have to describe this as if your writing to a small child.

    Thanks again

Sign In or Register to comment.