How to get my timer to count down not up?

Currently, I’m working on an endless runner that will end the game (level) when the time is up. I’ve gone through a lot of tutorials on timers. And I’ve successfully set one up in my HUD but it doesn’t count down. It counts up.

Here’s my set up

Any info on this would be greatly appreciated. Thanks in advance.

Okay, I’ll try that out.

You have a basic problem with your loop. The tick is called every frame, the delay doesn’t really do anything, you have thousands of delays all lining up doing nothing… :slight_smile:

Basic loop looks like this:

And to show the time ( I used print, but you get the idea… ):

1 Like

You’re giving yourself a hard time trying to separate minutes and seconds, just count seconds and only split it when you show it… :slight_smile:

( same problem with delay on tick there… )

Hi, as far as I see your timer should work. I would try to print “Time Min” after setting it in your branch to see were it’s going. And did you set “Time Min” to a value greater than 0 at the beginning?

And instead of counting the time manually I would use the “Get Game Time In Seconds” Node and create a max time variable (the amount of time your game will be running before pausing). Then you can substract those two to get the remaining time. Then you can use the “Division (whole and remainder)” Node to get the remaining time in minutes and seconds.

And it seems to me that you then don*t need an event tick but can use a timer. The difference is that a timer will not be called every tick that makes it more efficient.

Thank you both! I’ve tried both methods and they work well.

Currently I’m using ClockworkOcean process but I need the text to be in a certain font face. Also once it count down hits 0 it continues into the negatives. Could you help me figure those parts out as well?

Thanks again.

Just change the decrement branch to:

Thanks! that worked perfectly. Can I change the font? Like applying paint text? Or am I overthinking it?

Are you using print still? If so, you need to use a widget to display the time remaining, then you can change the font.

O: yes, I’m still very new to this. But how do I apply the widget? I’m so for all these questions. Thanks again for helping.

Sorry, was a bit pushed for time, this is about binding widgets to variables. It will automatically show time remaining, you don’t need to keep printing it out: