Examples: SetTimer1(0.05); SetTimer2(1); SetTimer3(this.timer); etc.
then either something like this:
PHP Code:
function onTimeout1(){blahblah;}
function onTimeout2(){blahblah;}
function onTimeout3(){blahblah;}
etc.
or something like this:
PHP Code:
function onTimeout(1){blahblah;}
function onTimeout(2){blahblah;}
function onTimeout(3){blahblah;}
whichever works. setTimer(); would still be usable.
unless someone knows a better way to do this already, i've often found myself splitting up weapons into multiple weapons because i couldnt redefine onTimeout in one if(){;} and have another in an elseif(){;} (example, having my jump script change itself to a gravity script if the level is a sidescrolling level. but i couldnt do that so now i have a jump script that disables itself if its a sidescrolling level and a gravity script that activates if its a sidescrolling level. which seems like more than i needed to have.)
then, whenever i need multiple timers and cant split up the script, i also find myself doing something crude like this:
PHP Code:
function onTimeout(){
if(this.timer1 >= 0.05){
this.timer1 -= 0.05;
}
else {this.timer1 = 1;}
if(this.timer2 >= 0.05){
this.timer2 -= 0.05;
}
else {this.timer2 = 0.5;}
}
setTimer(0.05);