Timer

This forum is currently in read-only mode.
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • How do you do a basic timer in construct?

  • What are you timing?

  • No just a timer like countdown, actually, count up timer...

    Also, it should be activated and not run in 'Always'

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Okay then. Here's how I did the timers in This Cursed Rock (I had a lot of cutscene events that were dependent on time).

    Create a variable called "timerCount" either as a global or in one of your objects. Next, create a variable called "timerStart." Set both to default at 0.

    Next, when you want your timer to start, set "timerStart" to 1. Then do this:

    +Value('timerStart') equal to 1
    +Every 1000 MS
       ->Add 1 to Value('timerCount')
    [/code:1wjhlad9]
    
    Then every second it will add 1 to timerCount.  Actually, the way "Every x MS" works is it will add 1 to timerCount immediately when it starts, rather than waiting 1 second, so at the end of 1 second your timerCount will be 2, at the end of 2 seconds your timerCount will be 3, and so on, so it'll always be one number ahead of the actual number of seconds passed.  If you need an exact count you can add an event that checks for another variable called "beginCounting" or something:
    
    [code:1wjhlad9]
    +Value('timerStart') equal to 1
    +Every 1000 MS
       +Value('beginCounting') less than 2
          ->Add 1 to Value('beginCounting')
       +Value('beginCounting') greater than 1
          ->Add 1 to Value('timerCount')
    [/code:1wjhlad9]
    
    This is just how I did my timers though, I'm sure there are other, better ways to do it.  And if this doesn't do what you need then I suggest you get a little more detailed with your question, it'll be easier to help you that way.
  • Thank you.. I tried the concept and it worked.

  • You can also use the Function object to call a function after X milliseconds.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)