1 decade ago by peepli
Hello,
I am trying to reset my timer after a certain event is triggered. Currently I have my in-game timer which checks for that event every 4 seconds in my update as follows
So my function performAchievementchecks() is called every 4 seconds and within that time if its if statement goes true then I want to reset my timer back to 0 but it does not do it. Could someone please point out what is it that I am doing wrong? If so how do I reset my game timer from other different functions outside the update()?
I am trying to reset my timer after a certain event is triggered. Currently I have my in-game timer which checks for that event every 4 seconds in my update as follows
timer: new ig.Timer(), update:function(){ //console.log(this.timer.delta()); if (this.timer.delta() >= 0) { this.performAchievementChecks(); this.timer.set(4); } }, performAchievementChecks:function(){ if(tempArray.length >= 1 && this.Achievements[achID].status == this.storage.get(achKey)){ this.performUpdate(achID); } } performUpdate:function(achID){ this.timer.set(0); this.updateAchievements(achID); }
So my function performAchievementchecks() is called every 4 seconds and within that time if its if statement goes true then I want to reset my timer back to 0 but it does not do it. Could someone please point out what is it that I am doing wrong? If so how do I reset my game timer from other different functions outside the update()?