Timer through scenes question

snapesnape Member Posts: 9

Hello,

Sorry I have scoured online for this info but I just can't find it.

Is it possible to create a timer that doesn't reset from scene to scene.

I would use the game timer but as it keeps going after a new game is started it's no good to me.

I'm basically putting a time limit on the whole game and it's not scene dependant.

I'm very new to GS by the way.

Thanks

Spencer

Comments

  • Thunder_ChildThunder_Child Member Posts: 2,343
    edited May 2015

    Make a game level integer called timer...or whatever you want to call it...

    Now make an actor sized 40x40...

    Make a timer that...every 1s change attribute game.timer to game.timer+1

    In this actor place a "timer" that...every 1s save attribute (game.timer)....with "t" as its ID.

    Also place a "Load Attribute" behavior...load your game.timer attribute

    Now place this actor in each scene in the bottom left corner...just out of scenes view.

    This will...at each scene start up load the current timer.

    Be sure to create a rule that says "When " "timer" "=" (x)....game over or what ever you plan on doing...

    Also add a rule that when game is "over"...to change timer attribute to 0 so when new game starts the timer has reset.

    Pretty sure that should do the trick. @snape

    If by chance you notice the timer continues to run during even the scene change you could always place a pause game behavior with scene change to next scene. In each scene at the top place a un-pause behavior also.

    I believe this would make sure that if it takes 8s for scene change...the timer would not reflect an additional 8s...I have not ever tested this exactly as I state. Play with it but it's right on target for you

  • snapesnape Member Posts: 9

    That's great thanks for the info. Much appreciated!

Sign In or Register to comment.