MaxLos
Member
Noob question but I could not find any topics regarding this. How do deplete a diagonal life bar properly?
This is the code I was using for horizontal bars:
But it doesn't really properly fill/deplete bars that are tilted.
This is the code I was using for horizontal bars:
Code:
var spriteWidth = sprite_get_width(spr_healthbar); //Width of health bar sprite
var spriteHeight = sprite_get_height(spr_healthbar); //Height of health bar sprite
var HealthPercent = obj_player.HP/obj_player.MaxHP; //Percentage of health left
draw_sprite_part(spr_healthbar, 0, 0, 0, spriteWidth*HealthPercent, spriteHeight, 0, 0);