Adding Pause, Resume, Reset to Countdown Timer

Rob,

Thanks for the great tutorial on creating a countdown timer.  

I am trying to implement a 2 Minute countdown timer for my game.  I want to have pause, resume and reset buttons as well.  Is it possible to add these elements to the tutorial? 

Here is the link to the tutorial I am referencing: 

https://coronalabs.com/blog/2015/04/28/tutorial-implementing-a-countdown-timer/

Thank you!

Christi 

We provide tutorials as a starting point for you. They are not designed to be complete modules but learning exercises. As a rule we don’t go back and change tutorials to provide more functionality. We would encourage you to explore adding that yourself.

Rob

Rob,

Thanks as always for your quick response.  I had an easy time setting up my 2 minute timer to run with your tutorial but had a really difficult time determining why the timer.pause(countDownTimer) wasn’t working.  I realized that I had to forward declare (I think that is the right term) the variable “local countDownTimer” at the beginning of the page of code and then remove the “local” when running the timer in the button function for it to work.  FINALLY!  I am up and running and it works perfectly.  

One other tip I think is helpful: set up a timer_status variable for “running” and “paused” so you can check if it is running or paused before executing the functions.  

Thanks 

Christi 

I’m glad you were able to work it out!

Rob

We provide tutorials as a starting point for you. They are not designed to be complete modules but learning exercises. As a rule we don’t go back and change tutorials to provide more functionality. We would encourage you to explore adding that yourself.

Rob

Rob,

Thanks as always for your quick response.  I had an easy time setting up my 2 minute timer to run with your tutorial but had a really difficult time determining why the timer.pause(countDownTimer) wasn’t working.  I realized that I had to forward declare (I think that is the right term) the variable “local countDownTimer” at the beginning of the page of code and then remove the “local” when running the timer in the button function for it to work.  FINALLY!  I am up and running and it works perfectly.  

One other tip I think is helpful: set up a timer_status variable for “running” and “paused” so you can check if it is running or paused before executing the functions.  

Thanks 

Christi 

I’m glad you were able to work it out!

Rob