actionscript 3 - Increase Timer interval -
i have timer calls function 'bottlecreate' 500 500 miliseconds. want time increase during game (getting faster creation of bottles, , game gets more difficult). don't know how increase variable inside new timer. thanks
interval=500; var my_timer=new timer(interval); my_timer.addeventlistener(timerevent.timer, bottlecreate); my_timer.start();
you want game faster, variable needs decrease, because less time between function calls make faster.
according documentation of timer class can use delay variable change interval speed.
so, make faster, write
my_timer.delay -= 50; each time this, function call called 50 ms faster.
be aware though, going beneath 20ms cause problems, according documentation.
furthermore, each time manipulate delay variable, timer restart completely, same repeat count use @ initialization.
Comments
Post a Comment