x


removing numbers after time

by using "Health -= 1;" in javascript i can take 1 away from health if a certain need is met... but how do i make it take one away every second... thanks :)

more ▼

asked Mar 24 '11 at 09:19 PM

oinkoinkflapflap gravatar image

oinkoinkflapflap
193 42 54 66

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

3 answers: sort voted first
more ▼

answered Mar 24 '11 at 09:43 PM

Eric5h5 gravatar image

Eric5h5
80.2k 41 132 519

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

To expand on what efge said:

health -= Time.deltaTime

Will reduce the health by one unit per second, but it's not rounding to integer values. I'm not sure if you want to do a health bar, or have rounded numbers or not, you didn't really say.

more ▼

answered Mar 24 '11 at 09:43 PM

Andy Korth gravatar image

Andy Korth
66 5

(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:

x3459
x572
x76
x37

asked: Mar 24 '11 at 09:19 PM

Seen: 1156 times

Last Updated: Mar 24 '11 at 09:19 PM