Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
08-03-2012, 05:59 AM #1
- Join Date
- Aug 2012
- Thanked 0 Times in 0 Posts
Timer that counts down then counts up when button is pushed.
I am trying to write a timer that counts down from 20 seconds to zero seconds. If a player pushes a button before timer reaches zero then the timer reverses direction and starts to count up to 40 seconds, and again if a player pushes before the timer reaches 40 it reverses and starts to count down to zero. This loop never stops unless the timer reaches zero or 40 in which case a buzzer sounds an play is over.
08-03-2012, 08:15 AM #2
- Join Date
- Jun 2002
- London, England
- Thanked 2,577 Times in 2,555 Posts
This forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others (especially code that appears to be for homework), but try to help with fixing code that doesn't work. You may perhaps get someone to write this script for you, but you'll be far more likely to get help if you have made a substantial effort and written some code yourself. Then someone here will almost certainly help you correct/improve your work.
Timers have been covered very many times in this forum - have you tried using the search feature?
It is your responsibility to die() if necessary….. - PHP Manual
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.