Hey, so I’m new to Defold and was wondering if there would be any way to create a healthbar like this for a hit points system. You initially start with 3, but as your max hp would increase, they would evenly fill the same healthbar with more squares, and once those were maxed, theu would turn yellow representing 2 hit points.
my question is:
should I make sprites for every single health level? Or would the healthbar background (and maybe a blank square icon) be enough and i can dynamically create these hit points so that they scale properly as well?
The way I would approach this would be adding a sprite for background. Then would have multiple sprites on the background sprite. Hide them at first, and show 4 of them if the hp bar will have 4 units as hp. You can set the tint of sprites via script and set their size too as needed.
Decide how much separation you need between them
size of 1 unit = (bg_sprite.size.x - separation*(unit_count + 1))/unit_count