x


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

more ▼

asked Dec 11 '10 at 06:39 AM

Tyler 2 gravatar image

Tyler 2
1.1k 211 246 264

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

After increasing the value, set a function to decrease it back using yield.

speed=10; // for 2 seconds

yield WaitForSeconds (2);

speed = 0;
more ▼

answered Dec 11 '10 at 07:32 AM

denewbie gravatar image

denewbie
717 3 3 17

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x819
x572
x76

asked: Dec 11 '10 at 06:39 AM

Seen: 535 times

Last Updated: Dec 11 '10 at 06:39 AM