- Home /
timed value increase?
Hello. How can I have it so that a static variable (in this case, a number) is increased, but only for a certain period of time (like a nitrous boost for a car)?
something like if...speed=10; for 2 seconds
Thhanks
Comment
Best Answer
Answer by denewbie · Dec 11, 2010 at 07:32 AM
After increasing the value, set a function to decrease it back using yield.
speed=10; // for 2 seconds
yield WaitForSeconds (2);
speed = 0;