How do I timer countdown?

Get help using Construct 2

Post » Mon Oct 02, 2017 3:12 am

Hi Everyone!!

I have been moving forward with my little project, and wanted to add Global Variables of Time and Score, but using bitmap fonts I've created.

https://www.dropbox.com/s/3iu4s8v8ts5hd5c/help_1.png?dl=0
Bitmap Fonts works on the engine

https://www.dropbox.com/s/qdyvo4l36pr5y7z/help_2.png?dl=0
Bitmap Fonts on the HUD layer

What I want to do is to have the timer in its maximum time of 300 seconds and every 1 seconds, the Time subtract by a 1 seconds.

However, nothing happens and even the bitmap I have given an instance with value, but nothing happens, I have seen videos on the subject but it does not work for me.

https://www.dropbox.com/s/l2a2bp2vch73tpx/help_3.png?dl=0
Event Sheet

If there is a solution I will thank you!!

Cheers
Last edited by Kyu on Tue Oct 03, 2017 6:07 pm, edited 3 times in total.
B
10
S
3
Posts: 16
Reputation: 842

Post » Mon Oct 02, 2017 4:26 am

Your link to the Event Sheet is invalid.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
72
Posts: 1,085
Reputation: 39,233

Post » Tue Oct 03, 2017 6:08 pm

dop2000 wrote:Your link to the Event Sheet is invalid.


I just fixed the link, I hope you can see the image. ;)
B
10
S
3
Posts: 16
Reputation: 842

Post » Tue Oct 03, 2017 6:13 pm

You're subtracting from a different variable, my guess is you're displaying Time? You're subtracting from TIME_COUNT. Probably subtract from Time_Fonts.Time
B
47
S
18
G
84
Posts: 2,273
Reputation: 49,800

Post » Mon Oct 09, 2017 1:40 am

plinkie wrote:You're subtracting from a different variable, my guess is you're displaying Time? You're subtracting from TIME_COUNT. Probably subtract from Time_Fonts.Time


Hi!
I tried to do that for every 1 second, 1 is subtracted from time_font, but there is no case, the counter does not decrease, I am not using the global variable.
https://www.dropbox.com/s/xnepk53b9tc4rdj/help_4.PNG?dl=0

If I'm using a bitmapfont for the timer, how should it work?
B
10
S
3
Posts: 16
Reputation: 842

Post » Mon Oct 09, 2017 1:47 am

Are you sure the problem is with the spritefont and not somewhere else in your code?
Does it work if you use a text object instead of the spritefont?

Is your Time_Countdown group always enabled?

Start your game in Debug mode (ctrl-F4) and check time_font variable - if it's decreasing every second.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
72
Posts: 1,085
Reputation: 39,233

Post » Mon Oct 09, 2017 1:55 am

dop2000 wrote:Are you sure the problem is with the spritefont and not somewhere else in your code?
Does it work if you use a text object instead of the spritefont?

Is your Time_Countdown group always enabled?

Start your game in Debug mode (ctrl-F4) and check time_font variable - if it's decreasing every second.


Hi!!
Thanks for answering!!
https://www.dropbox.com/s/p4pem1dz2rhvb6a/help_5.PNG?dl=0

You're right inside the system it works, but how do I then visually lower the counter?
B
10
S
3
Posts: 16
Reputation: 842

Post » Mon Oct 09, 2017 2:16 am

So you set your spritefont text to "300" on start of your layout, but where is the event that updates it every second?
You update your variable, but not the spritefont object.
You need to add "Time_Fonts Set text to time_font" into the "Every 1 second" event.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
72
Posts: 1,085
Reputation: 39,233

Post » Mon Oct 09, 2017 2:42 am

dop2000 wrote:So you set your spritefont text to "300" on start of your layout, but where is the event that updates it every second?
You update your variable, but not the spritefont object.
You need to add "Time_Fonts Set text to time_font" into the "Every 1 second" event.


Ok, I was able to add this new action within the condition.
https://www.dropbox.com/s/nnig7uss46qhrfs/help_6.PNG?dl=0

But the counter is deleted in the HUD.
https://www.dropbox.com/s/gv1tsa94828wc89/help_7.PNG?dl=0
B
10
S
3
Posts: 16
Reputation: 842

Post » Mon Oct 09, 2017 2:55 am

Not to "time_font", to time_font without the quotation marks!
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
72
Posts: 1,085
Reputation: 39,233

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, hao102a2 and 27 guests