Ninjadoodle Posted September 1, 2017 Share Posted September 1, 2017 Hi guys Just wondering if there is a way to stop a timer at 0? I've setup a countdown timer, but when I log the output, the time keeps going into the minus after reaching 0. Thanks heaps for any help Quote Link to comment Share on other sites More sharing options...
enpu Posted September 6, 2017 Share Posted September 6, 2017 Can you show example your code? Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 6, 2017 Author Share Posted September 6, 2017 Hi @enpu Here is how I have it setup ... mousedown: function() { // START TIMER this.timer = this.addTimer(1000, function() { this.failed = true; console.log(this.failed); }); }, update: function() { this.timerText.setText(this.timer.time()); } The timeText always shows a different number when the timer is done ... never zero. Thank you! Quote Link to comment Share on other sites More sharing options...
enpu Posted September 6, 2017 Share Posted September 6, 2017 I made some changes to Timer. Can you try now again. Ninjadoodle 1 Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 6, 2017 Author Share Posted September 6, 2017 Hi @enpu It works perfectly now, thank you for the fix! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.