Game Development Community

Time

by Petrov_Ivan · in Torque Game Builder · 08/21/2010 (10:57 am) · 3 replies

Some object in my game must do some actions with some time interval. Time Interval i want enter. I use TGB. Please help.

#1
08/21/2010 (12:06 pm)
Look up schedule and you should find what you are looking for. :-)

For a class fuction use
%object.schedule(500,"functionName");


For a global fuction use
schedule(500,0,"functionName");


(500 is the time interval in milliseconds)
#2
08/30/2010 (7:05 am)
Thank you! But i want use timer in my game. Any ideas?
#3
08/30/2010 (7:25 am)
%obj.setTimerOn(2000);//callback every 2 seconds


if objClass is the className of the %obj:

function objClass::onTimer(%this) {
  //Timer Body
}