+2 votes

Hi all,

I have a timer and I want to specify exactly the time left on it.

Currently due to some game logic requirements I'm:

  • starting timer
  • counting down towards 0
  • pausing the timer when required (making inactive)
  • rebuilding timer back towards its wait_time

The first part is all fine, but when trying to rebuild towards the wait_time I'm running into an issue.

I can't find a way to slowly increment the timer back up again. I can set the wait_time, that's fine, but when paused the timer still sits at the value it was at, then when I unpause the timer, it just continues counting down to 0 from where it was paused.

Setting the wait_time doesn't do what I need as it keeps counting down from the paused value anyway (the get_time_left() value). Does anyone know of a way to set the actual time remaining?

My fingers and toes are crossed. Thanks a tonne... Rob

in Engine by (838 points)
edited by

1 Answer

+1 vote
Best answer

If you want to reset the timer, you need to start it again:

timer.set_wait_time(new_time)
timer.start()
by (29,120 points)
selected by

Thank you... and bummer... I have to change my logic a little now. Oh well, a learning experience. Shame we can't just intercept and say "Set Time Remaining to X". Much appreciated though. Thanks again.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.