How do I work with timers?

  • cvp Thanks man,,,, i didn´t get yet,,,, but i´m trying.... i don´t no how to compare the timestamp with 2 days, by example....is

    in this example i did only a test to compare before and after,,,

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I dont have C2 available atm. But you have all the information you need available in the attachment you have shown above.

    The timestamp is a number. The number is counter of milliseconds since january 1. 1970.

    so in a sence you can just record the "start" time as you do on your first click. Like: system -> set date to Date.UnixTimestamp

    then you just have to compare you start time to the current time. (if you are comparing in days you should not compare every tick, but at a more fitting interval)

    You can then calculate the amount of days that has passed since your your starttime. that would be:

    (Date.UnixTimestamp - date)/(1000*60*60*24)

    That find the difference in milliseconds between the two timestamps. The last part converts the milliseconds into days. You have all the other conversions available in the text as well if you want it in something else then days.

    Hope that helps a bit.

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