Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Quick timer question.

hrsmediahrsmedia Posts: 522Member
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 Posts: 4,172Member
    Interpolate has a timer. Did you increase the timer if you wanted it to move more slowly?
  • hrsmediahrsmedia Posts: 522Member
    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 Posts: 4,172Member
    The "duration" part... if you think it's counting too fast, maybe try 5 or 10 instead of 1.
  • scitunesscitunes Posts: 4,047Member, Sous Chef
    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 Posts: 1,803Head Chef, Member, PRO
    > 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 Posts: 522Member
    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 Posts: 522Member
    @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 Posts: 4,047Member, Sous Chef
    Look at FireMapleGame's profile for his time demo - it has everything you need.
This discussion has been closed.