Sign in to follow this  
Ninjadoodle

Any way to stop a timer at exactly 0?

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.