Scheduling
by Derek Kittrell · in Torque Game Builder · 03/07/2005 (8:45 pm) · 4 replies
Okay, I want to add a weapon which will explode after a specified amount of time. I was checked to see if there was some sort of onLifetimeExpire function, but I didn't see anything along those lines. I couldn't see how to pass a variable (in this case, the object) to a schedule, so since I'm defining the projectiles locally in a function, I don't really have a convenient reference to them after they're created. What would be the best way to do this? Also, I was curious about scheduling.. the documentation shows schedule(time, command, ). In every schedule I've seen, the "command" is 0.. what exactly does this mean, and what are the possible options?
Thanks
Thanks
About the author
#2
03/07/2005 (9:04 pm)
Ah, I see.. that makes perfect sense now. Thanks!
#3
03/07/2005 (9:56 pm)
Glad it makes sense :)
#4
setLifetime()
Set Objects' Lifetime.
(lifetime)
“%obj.setLifetime( 10 )”
lifetime - Lifetime of object (seconds). Setting a lifetime for an object results in the object being automatically destroyed when its lifetime is up. This lifetime is its life within a scene. Setting a lifetime of 0 gives the object infinite life which is the default.
"Torque 2D/Reference Guide"
07/24/2009 (8:57 am)
setLifetime() is what You need I think.setLifetime()
Set Objects' Lifetime.
(lifetime)
“%obj.setLifetime( 10 )”
lifetime - Lifetime of object (seconds). Setting a lifetime for an object results in the object being automatically destroyed when its lifetime is up. This lifetime is its life within a scene. Setting a lifetime of 0 gives the object infinite life which is the default.
"Torque 2D/Reference Guide"
Torque 3D Owner Matthew Langley
Torque
Torque 2D Unofficial F.A.Q.