I have this code for my timer, it counts down alright. BUT it is very buggy it most commonly counts down by 2 when it is meant to count down by one:*( I have even watched my brother play our game and it went fron 20 to 7!!! any help would be greatly appreciated. If anyone could even give a code that counts down in minutes and seconds would be majorly appreciated. But yeh, I don’t know what is causing it so please help a man in need LOL:D
var cur_timer = 180;
function timer() {
if (cur_timer > 0) {
cur_timer--;
} else {
cur_timer = "Time up!";
gotoAndPlay("43")
clearInterval (time_interval);
}
}
time_interval = setInterval(timer, 1000);
EDIT: OK i have figured it out… It is when you die it goes to a different frame and then it comes back to the original frame while the interval is still going, so if you die 2 times it would go down 2 times a second, you die 3 times it goes down 3 times per second etc. However i cant figure out how to stop it anyone help?