Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Feature request
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-03-2010, 09:49 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Lightbulb SetTimer<#>(<#>);

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); 
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.