Countdown timer object -
11-28-2011, 08:10 PM
Apologies if similar objects have been posted before, but here's my version of a countdown timer object.
The main methods are
- displayTime, refreshes the time
- updateTime, occurs approximately every second
- resetTime, resets the time to the default starting time
- setTime, sets the default starting time. Also sets the current time to the default
- stopTimer, stops the timer
- startTimer, starts the timer
I used the "when ... true" event to run updateTime continually when the timer is not stopped.
I used "when key pressed" events to call stopTimer, startTimer and resetTimer.
I called setTime in an initialisation method inside a "when world starts" event.
For video tutorials on programming in Alice 2.2 check out my YouTube channel
http://www.youtube.com/user/drdave785
Also check out my Programming in Alice blog at
http://programminginalice.com
|