Timer as score

0 favourites
  • 4 posts
From the Asset Store
Tabata timer
$4 USD
60% off
Template for Tabata timer, fully documented in comments and video
  • Just finished the beginning tut and wanted to see how I could create a timer that starts when the game launches and will end (when player dies etc)

    When I changed it to every tick update timer by 1 it changed 60 per second which I can understand why.

    My problem is how do I tell it every 60 ticks to ++ then get that into a "time" format.

    I'm guessing I'd have to format it somehow with a / then display the results? like 120 seconds/60 = 2 Minutes? Am I over thinking this?

  • global variable Timer
    System: Every ticks
        -> add dt to Timer
        local variable min
        local variable sec
            -> System: set min to floor(Timer/60)
            -> System: set sec to int(Timer)%60
            -> Text: set Text to right("00"&min,2)&":"&right("00"&sec,2)

    dt is a special word in c2 that return the time spent between two ticks. so after 60 ticks if you run at 60fps, so 1 second later, Timer will equal 1 (what a coincidence!)

    also the right(string,length) function return the right part of a string, so the expression will zero fill the number.

    % is the modulo operator:

       0%60 = 0

    20%60 = 20

    60%60 = 0

    80%60 = 20

    value tends to cycle when you use modulo. (officially a%b gives the remainder of the euclidian division of a by b... unofficially... easy cycling)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome! Thank you both!

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