Hey everyone so basically I have a main timer which keeps track of how long the player has until the game is over. If the timer is done counting down then the game is over. I also have items on the stage as well as purchases to add more time to the clock so they can keep playing.
The bug that I am encountering is that when the player adds more time to the timer it shows on the text field that time was added and it continues to count down but it doesn't actually add more time and still ends after 60 seconds.
What could be causing this issue here is my current code below thanks!
In my constructor:
//Count down timer
count = 60; //Count down from Number
tCountDownTimer = new Timer(1000, count);// Timer intervall in ms
updateCountdownTimer();
tCountDownTimer.addEventListener(TimerEvent.TIMER, countdown);//EventListener for intervalls
tCountDownTimer.addEventListener(TimerEvent.TIMER_COMPLETE, countdownComplete);
Here is my countdown
Timer event:
private function countdown(e:TimerEvent):void
{
//Display Time in a textfield on stage
updateCountdownTimer();
}
public function updateCountdownTimer():void
{
cntDowntxt.countDownTextField.text = String((count) - tCountDownTimer.currentCount);
}
In a seperate function when the player touches the clock this is how I add more time:
count += 10;
updateCountdownTimer();
Could you see what I am doing wrong?