- Home /
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 :)
Answer by Andy Korth · Mar 24, 2011 at 09:43 PM
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.
Your answer
Follow this Question
Related Questions
Adding a value to a variable every second? 1 Answer
Instantiating object after some fixed time... 2 Answers
How can I show the time in this Day/Night Cycle Script 1 Answer
how to stop every thing and enter into the OnTriggerEnter function? 0 Answers
Repeatedly creating infinite loops slows down code 2 Answers