Draw a HUD Bar for player variables
-
this is a function you could use to easily draw a bar for player/enemy health, stamina, mana etc. Very versatile, can be customised easily and features a colour shifting effect with interpolate() as it changes size.
Initially this was a response to another user's request for some help, but the function is actually simple and useful enough that I think it might be valuable here!
function drawBar(x, y, width, height, value, maxValue, colourEmpty, colourFull) w = width/maxValue * value t = w/width col = interpolate(ease_in_out, colourEmpty, colourFull, t) box(x, y, w, height, col, false) return void // Example usage (using some example variables 'health' and 'maxHealth'): drawBar(100, 100, 300, 50, health, maxHealth, red, lime)
-
Thanks, let you know if I failed jt
-
You mean I don't have to draw 100 tiles to display boss health ! 😉 Cheers will try later
-
@AlexTheNewCoder Make sure to check out the more detailed reply I left for you on the original thread!