How do I set timer (revised to make it easier to help)?

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hey C3 World!

    Below are the results of many, many failed attempts which brought me to asking the experts. Right now everything works except the countdown decreases in some very small measurement (maybe -0.000001 or something). Timer isn't counting down by 1 a sec. Thanks for the help.

  • dt*your development platform target framerate

    Normally 60.

  • There is a built in object called Date, adding this allows you to work with Dates and times.

    I made a quick video to help you set a basic countdown timer and you can build it from there:

    youtu.be/tf-rHSselE8

    Best of luck :D

  • There is a built in object called Date, adding this allows you to work with Dates and times.

    I made a quick video to help you set a basic countdown timer and you can build it from there:

    https://youtu.be/tf-rHSselE8

    Best of luck :D

    Brilliant work and much appreciated. I will be referencing that often as I seem to not retain as much as I'd like. Thank you!!

  • dt*your development platform target framerate

    Normally 60.

    I'm sure the answer is there however I'm not seeing it.

    So this?

    floor(max(0, Oil_Sell_Timer - dt*60))

    It counts down 9...8... and stops, resets to 10 and makes it to 8 before repeating the process.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh so a couple things.

    You don't want to floor that, or it will defeat the purpose of dt, which gives you fractions of seconds. If you floor it, it will go to the next lower whole number no matter what framerate you're running at. Use an intermediate variable to keep track of the actual time, and only floor the displayed time.

    Resetting to 10 when you get to 8 is something else entirely, so you're going to have to look elsewhere.

  • Thanks for the info on that. Makes sense.

    I'm just going to leave the timer portion alone for now as it's not making any sense that the countdown works in a test project but not in the long-term one. And I'm just putting random numbers into random conditions/actions testing since I don't know enough about timers.

    I appreciate the help regardless. Take care!

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