How do Timer countdown ?

0 favourites
  • 12 posts
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • Hello.

    I need to make a counter that only lasts 10 seconds.

    Must be countdown, but that shows the seconds and thousandths of seconds.

    Already check several tutorials but are a little confused, can someone help me with this.?

  • This is a simple example.

    Create a global variable for example "My_Timer" and make it a number value of 10.

    On Start of Layout > Every 1 Second > Subtract 1 from "My_Timer"

    System > My_Timer =0 > Do Somethng

  • Since you requested thousandths of seconds, you'll need to use dt every tick and do some adjustments.

    Commented example: ThousandthsTimer.capx (r168)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a simple example.

    Create a global variable for example "My_Timer" and make it a number value of 10.

    On Start of Layout > Every 1 Second > Subtract 1 from "My_Timer"

    System > My_Timer =0 > Do Somethng

    Thanks for your explanation, but I will use the method OddConfection.

  • Since you requested thousandths of seconds, you'll need to use dt every tick and do some adjustments.

    Commented example: dl.dropboxusercontent.com/u/90589590/C2%20Examples/ThousandthsTimer.capx ThousandthsTimer.capx (r168)

    Thanks for the CapX.

    It was very helpful.

    Any questions can be modified to the thousandths of a second are only 00.?

    I had another question but I forgot...

  • Saletti - You're welcome, I'm glad it was helpful.

    You can add/remove decimal places by adding/removing 0s from the ends of the numbers in the calculations including the starting value.

    Let me know if you remember your other question.

  • Saletti - You're welcome, I'm glad it was helpful.

    You can add/remove decimal places by adding/removing 0s from the ends of the numbers in the calculations including the starting value.

    Let me know if you remember your other question.

    If friend, I remembered the question, but is a bit complex.

    First I'll tell you what I'm trying to make.

    The aim of my game is that I have to destroy a number of enemies in a given time. The amount of enemy changes at every level of the game.

    at destroy the enemy, the timer will stop showing me how long it takes.

    How do you stop the timer when I destroy all enemies.?

  • You can use a global variable to stop/start the timer

    I did an example of that for someone else - https://dl.dropboxusercontent.com/u/905 ... topGo.capx

    In that example you press go to start the timer and stop to stop it. The timer counts upward instead of down, but the principle of stopping/starting it is the same.

    You would need to check that there are no enemies left to kill and then set the global variable that controls the timer to false/off

    If all enemies are spawned at the start just do System->Compare Two Values->Enemy.Count = 0 (where Enemy is the sprite/family of the enemy objects)

    If enemies are spawned over time, use a global variable to track how many enemies are killed (Enemy->On Destroyed : System->Add 1 to EnemiesKilled) and compare that to a variable used to track how many Enemies are to be spawned that level.

  • You can use a global variable to stop/start the timer

    I did an example of that for someone else - dl.dropboxusercontent.com/u/905 ... topGo.capx

    In that example you press go to start the timer and stop to stop it. The timer counts upward instead of down, but the principle of stopping/starting it is the same.

    You would need to check that there are no enemies left to kill and then set the global variable that controls the timer to false/off

    If all enemies are spawned at the start just do System->Compare Two Values->Enemy.Count = 0 (where Enemy is the sprite/family of the enemy objects)

    If enemies are spawned over time, use a global variable to track how many enemies are killed (Enemy->On Destroyed : System->Add 1 to EnemiesKilled) and compare that to a variable used to track how many Enemies are to be spawned that level.

    Thank you.

    I'm doing tests and trying to understand his explanation, because my English is bad. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green" /> <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green" />

    I apologize for taking so long to respond.

    Greetings.

  • You can use a global variable to stop/start the timer

    I did an example of that for someone else - dl.dropboxusercontent.com/u/905 ... topGo.capx

    In that example you press go to start the timer and stop to stop it. The timer counts upward instead of down, but the principle of stopping/starting it is the same.

    You would need to check that there are no enemies left to kill and then set the global variable that controls the timer to false/off

    If all enemies are spawned at the start just do System->Compare Two Values->Enemy.Count = 0 (where Enemy is the sprite/family of the enemy objects)

    If enemies are spawned over time, use a global variable to track how many enemies are killed (Enemy->On Destroyed : System->Add 1 to EnemiesKilled) and compare that to a variable used to track how many Enemies are to be spawned that level.

    Hello.

    Sorry for the inconvenience, but took several days trying to do what you explained me to stop the counter and I can not get results.

    I can send you the CapX to see where my mistake.?

  • Saletti - Sure, no worries, attach a capx and I will take a look at it.

    I've made a modified version of the capx I linked before that you can look at as well, it spawns Enemy sprites which you have to click/tap to destroy and it stops the timer when all enemies are destroyed.

    Timer stop example (r173)

  • Saletti - Sure, no worries, attach a capx and I will take a look at it.

    I've made a modified version of the capx I linked before that you can look at as well, it spawns Enemy sprites which you have to click/tap to destroy and it stops the timer when all enemies are destroyed.

    https://dl.dropboxusercontent.com/u/90589590/C2%20Examples/StopGoEnemies.capx Timer stop example (r173)

    Hello.

    Here I leave the CapX.

    What I want is that the timer stops. When all enemies are destroyed

    the amount of enemy varies depending on the level of the game

    dropbox.com/s/v1bu4za9jha2zc1/Proyecto.capx

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