So I have the following Timer code
var platformTimer:Timer = new Timer(5000 / speed,0);
platformTimer.addEventListener(TimerEvent.TIMER, addPlatform);
function addPlatform(Event:TimerEvent):void {
generatePlatform();
trace("Platform Generated " + platformTimer.delay + " - " + platformTimer.repeatCount)
}
platformTimer.start();
The speed has a starting value of 3, but the value is constantly rising as time goes on. Therefore,
var platformTimer:Timer = new Timer(5000 / speed,0);
should start out as 5 / 3 and advance to 5 / 5 or 5 / 10
However, this doesn't happen. The trace
trace("Platform Generated " + platformTimer.delay + " - " + platformTimer.repeatCount)
always returns Platform Generated 1666.6666666666667 - 0
The speed is updated according to this bit of code
stage.addEventListener(Event.ENTER_FRAME, scoreCalc, false, 0, false);
function scoreCalc(event:Event) {
if (scrolling) {
score++;
}
speed = 3 + (score/1000);
Score.text = String(score);
return speed;
}
Any help?