(Solved) Reduce health after time

Hello there.

I have the “HealthBarBox” asset added to the scene. On top of it, I have “HealthBar” added. Also, I added a few objects to the stage, like “fruits” and a player added. Now, I want to create a condition in which the healthbar reduces automatically after a certain interval of time, like a few seconds. But the healthbar increases after the player collides with the fruits. how can I achieve this?

Hi, you just need to use a timer and if the time you have in mind is reached, you reduce the points from the health bar.

Hi, is the timer enough to achieve this? I have installed the “repeat every x seconds” extension. It is asking me to add the name of the timer to loop and time in seconds to trigger between each event. I am worried if this is the timer for the clock countdown type.

Okay. here is how I achieved this:

  1. At the beginning of scene → change the width of healthbar set to 477 or any number
  2. Add an extension called “repeat every x seconds”
  3. Add event: Repeat timer “reducehealthbar” every 5 seconds —> change the width of healthbar set to HealthBar.Width()*0.09

:slight_smile:

1 Like