Time based Leaderboard - how to display as 00:00:00 (M:S:MS)

0 favourites
  • 2 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hello,

    I have time based Leaderboards in my game.

    I count the time by adding dt every tick and my timer looks like something like this: 19.975983000000404

    From Google Play guidelines:

    [quote:262a2f9z]Time leaderboards present scores in hours / minutes / seconds / hundredths of a second format. You must submit scores as milliseconds, so 66032 would be interpreted as 1:06.03.

    So I use round(timer*1000) to have 19977 - wich works fine (gives 19.98 in the leaderboard)

    But I'm wondering how can I display 19977 as 00:19:98 (M:S:MS) in my game ?

    i've found this formula:

    zeropad(floor(timer/60),2) & ":" & zeropad(floor(timer)%60,2) & ":" & zeropad(round(timer*100)%100,2)

    but it needs modifications to works with round(timer*1000) and since i'm not friendly with Math it's hard for me to figure out .. Anyone know how to modify it accordingly ?

    Thank you if you can help !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry to bump, but anyone ?

    EDIT: I think I got it working thanks to R0J0hound

    (int(t / 60000) % 60) & ":" & (int(t / 1000) % 60) & ":" & (t % 1000)

    Only problem is that it gives 3 digits for MS but I've fixed it with my awesome skills of reducing the text size

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