Trying to trigger a timer and keep it running. Please Help!

KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
edited February 2012 in Working with GS (Mac)
Hello All,
I want to trigger a timer to start when I reach a certain height on the screen and have the timer continue counting down. (Basically if actor y=40 start timer counting down from 5 to zero.) I got it working but it only counts down if the actor stays at the position. I need the timer to keep counting down after the actor leaves from the spot where it triggered the timer. Hopefully this isn't confusing. Thanks in advance!

Thanks,
killerpenguins

Comments

  • GLGAMESGLGAMES SingaporeMember Posts: 988
    edited February 2012
    create a game.countdown(boolean)->False
    create a game.timer(integer)->5
    have a rule that if actor self.position.y =/> 40
    change attribute game.countdown to true

    In the timer rule have something like this
    when game.countdown = true
    timer every 1 sec,(click run to completion)
    change game.timer = game.timer-1
    then another rule when
    game.timer=0
    change attribute game.countdown = false
    change attribute game.timer = 5

    Hope this is clear enough for you :P
  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    Hey GLGames,
    I'm assuming that when you are saying to create a game.countdown trigger(boolean)-False and to
    create a game.timer(integer)->5, you are talking about creating them in the game's attributes? and thanks again
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    yes i wrote game.countdown didn't i?
    else it would be self.countdown.
  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    My apologies,I just wanted to make sure. Now this works but the only problem I am seeing is that when I start the level the timer starts and runs through once. How could I fix that if you might know. Thanks again for everything. Means a lot!

    Thanks,
    killerpenguins
  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    Got it to work. I said if actor self.position.y = 40 rather than =/> 40 and it worked. Thanks a bunch for your help GLGames. You have been a big help and it is greatly appreciated.

    Thanks,
    killerpenguins
Sign In or Register to comment.