How do Timer countdown ?

Get help using Construct 2

Post » Tue Jun 10, 2014 2:54 am

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.?
B
7
S
2
Posts: 13
Reputation: 597

Post » Tue Jun 10, 2014 3:01 am

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
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Tue Jun 10, 2014 3:36 pm

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

Commented example: ThousandthsTimer.capx (r168)
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,778

Post » Tue Jun 10, 2014 8:46 pm

TheDom wrote: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.
B
7
S
2
Posts: 13
Reputation: 597

Post » Tue Jun 10, 2014 9:33 pm

Message: Saletti can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
OddConfection wrote:Since you requested thousandths of seconds, you'll need to use dt every tick and do some adjustments.

Commented example: https://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... :mrgreen:
B
7
S
2
Posts: 13
Reputation: 597

Post » Wed Jun 11, 2014 10:08 am

@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.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,778

Post » Wed Jun 11, 2014 10:41 pm

OddConfection wrote:@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.?
B
7
S
2
Posts: 13
Reputation: 597

Post » Thu Jun 12, 2014 10:06 am

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.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,778

Post » Fri Jun 20, 2014 3:36 pm

Message: Saletti can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
OddConfection wrote: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.



Thank you.

I'm doing tests and trying to understand his explanation, because my English is bad. :mrgreen: :mrgreen:

I apologize for taking so long to respond.

Greetings.
B
7
S
2
Posts: 13
Reputation: 597

Post » Tue Jun 24, 2014 8:16 pm

Message: Saletti can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
OddConfection wrote: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.


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.?
B
7
S
2
Posts: 13
Reputation: 597

Next

Return to How do I....?

Who is online

Users browsing this forum: namaewayukidesu and 8 guests