Ranged Health For Animations?

So for my game, I wanted to have the animation of the health bar change when every 10% is lost or gained. Here are the health animations for each percent:

100-90: Green
90-80: Greenish Yellow
80-70: Yellow
60-50: Dark Yellow
50-40: Yellowish Orange
40-30: Orange
30-20: Dark Orange
20-10: Red
10-0: Dark Red

For example, if the player were to have 100 health, and they get hit by some enemies and they now have 83 health, the animation of the health bar will fall into the 90-80 range and that animation will play. Does anyone have any idea of how to do this?

1 Like

Current Health / 10 = X
Round up then put X into the “Go To” input on the Animation behavior

For example, 83/10 = 8.3, then Round-Up to get 9 as the input for the Animation behavior.

3 Likes

Do you have a visual example? Please, it would be very helpful. :slight_smile:

2 Likes

3 Likes

The expression says unknown error: elnvalidop(*/)

The expression only needs to say

A/10

that should be all

1 Like

It’s putting the animations in reverse, but I guess I can manually switch the animations around, thanks!

1 Like