need help with maths and health logic system
i made a health bar the current hp and max is 5/5 and hp can go up with upgrades to 100 max hp, i made the hp bar move right divide by 100 max hp
the problem is tho at 5hp the bar is so small because its doing 5 divide by 100, i want the part to be abit more longer as if it had 20hp length but still having 5 hp.
if i make the default length abit longer then it works fine but it messes the bar up when hp is between 1-4\ and the hp bar isnt going down equally.
how can i make a 5 hp bar look like a 20 hp bar and still lowers equally between 1-4 hp that can also scale up to 100 equally?
-
Okay, so one thing that probably won't help is... there's an output that is "remaining health (%)" which gives you the percentage of the "full health" value remaining.
If you want to scale the health bar range based on the "full health" value in some way, the signal manipulator should do nicely. Plug in the "full health" value, and change it to "custom remapper" mode. This acts like a funnel, taking values in from the left and squeezing them or stretching them to a different range of values to output. So here, perhaps have the input range be (5 - 100) and the output range be (0.2 - 1). Then multiply that by the "remaining health (%)" and use that to power your keyframe that resizes the health bar.
So when full health is 5 and you have 2 health left, you'd get: (0.2 * 40%). And when the full health is 100 and you have 80 health left, you'd get: (1 * 80%), something like that.
Not sure if that made sense, but it should do what you want it to. -
sorry i forgot to say im using a variable so it wouldnt conflict with the enemy health manager logic
what you said sounds interesting ill have to check that out for other projects
i came up with a fix tho i just needed another keyframe in the timeline at the 5hp mark to adjust where the hp bar should be at 5 hp then to scale to 0 hp.
thanks for your reply TAPgiles -
No worries ;D
Iniciar sesión para dejar un comentario.