Quick timer question.

hrsmediahrsmedia Member Posts: 522
edited November -1 in Working with GS (Mac)
I'm trying to do a timer
something like..
If attribute is true = start timer
If collide with actor stop timer

i'm trying to do use a real attribute and interpolate+1.00, but it counts up too fast.

Can anyone guide me?


  • PhoticsPhotics Member Posts: 4,172
    Interpolate has a timer. Did you increase the timer if you wanted it to move more slowly?
  • hrsmediahrsmedia Member Posts: 522
    I'm using

    Timer every 1 sec

    interpolate game.TestTimer to game.TestTimer+1.00
    duration 1

    it counts up too fast u say interpolate has a timer?
  • PhoticsPhotics Member Posts: 4,172
    The "duration" part... if you think it's counting too fast, maybe try 5 or 10 instead of 1.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Create a boolean called TimerOn
    Create a real called timer

    When game.TimerOn is true
    Timer every 1 second
    Change attribute game.timer to game.timer+1

    In collision actor

    When collides with other actor
    Change attribute game.TimerOn to true


    Change attribute game.TimerOn to false

    This will cause timer to count up when the objects are overlapping and stop counting when not overlapping.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    > interpolate game.TestTimer to game.TestTimer+1.00

    Also, using Interpolate to increment an attribute is a bad thing.

    When you use interpolate that game.TestTimer+1.00 is just going to keep moving the destination value.
  • hrsmediahrsmedia Member Posts: 522
    I changed duration to 2 and now seems to count up properly with decimals, but how do I get the initial text to display 0.00 instead of 0.
    scitunes I will try your method, thanks for help.
  • hrsmediahrsmedia Member Posts: 522
    @scitunes I looked at your method, that way doesn't show the decimal values counting up for each second, that's why I was trying to use interpolate..
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Look at FireMapleGame's profile for his time demo - it has everything you need.
Sign In or Register to comment.