(Solved) Health Bar scaling

Please help.

I want the player to increase the character stats (Health) but I cant keep the health bar at one size. When I increase the health of the character the health bar extends out of its “frame”. please help me.

2 Likes

For that, you need,

  1. Health bar object. (I hope you already have one)
  2. An object variable. set that variable value to 100.

The point is if you set the variable value to 50 that means player will have 50% health actually your health bar object will have 50% of it’s width.

To do that you need to run an action without any condition. Just like this:

Do = (400 * health_bar.Variable(health_val)) / 100 to the width of health_bar
Here 400 is the initial width of your health_bar object.

So, now if your player lose health for any condition, simply subtract the value of the object variable. And if your player win health then add value to the object variable.

Did you understand?

  • Yes😊
  • No😥
0 voters
Just trying out poll option
2 Likes

Hello, RIR360 has said it all except limiting the health bar. You would have to create a scene variable to prevent the health bar from exceeding the frame. Luckily i have a video that can help you.

This is a video on how to limit a bullet but it also works well for a health bar.

3 Likes