You forgot explosions, you've got explosions now! Great progress . I personally like vanilla the most.
I put it on my DevLog ;) but I wanted to keep the notes here consistent with the OP, which stated UI elements.
Otherwise, you could say I've added pathfinding AI (though it doesn't show in the provided example). ;)
Explosions really helped feedback though, hence why I went with vanilla, I felt that numbers were no longer necessary, but I wasn't sure if it was clear enough.
What about using a multiply blend? Multiply the green and blue color component with health ratio.
Can't say I'm familiar with that just yet, but I've been hitting a few limitations in regards to alpha in DartLang, so I'm not sure if I'll be able to do anything more complex.
I tried the following:
Layer 1 (Top) - Shield. Starts opaque. As it takes damage, transparency increases (this is still the case in the provided video)
Layer 2 - Red Mask. Starts Transparent. As the ship takes damage, it decreases transparency to show on top of ship.
Layer 3 (Bottom) - Ship. Always opaque.
Turns out layer 2 would show as opaque for as long as layer 1 existed. As soon as layer 1 became entirely opaque, layer two would reveal its true transparency.
For a time, I thought I was at fault, as I could've mistakenly made them children of the same parent, and the alpha channel would've considered all of what it had to render, but it wasn't the case.
It seems like Dart cares only for the topmost layer's alpha, which greatly limits what one can do.
My "solution" to circumvent that issue was to do as follows:
Layer 1 (Top) - Shield. Starts opaque. As it takes damage, transparency increases
Layer 2 - Ship. As the ship takes damage, its transparency increases, revealing the red mask underneath.
Layer 3 (Bottom) - Red Mask. Always opaque.
Issues I'm aware of:
- Layer 3 must be PERFECT, otherwise, there will be some red "bleed" on the sides of the ship even when its full (I fixed my masks to account for that, as, originally, I had changed all pixels to red, whereas some of them had some alpha, and would show through the ship).
- If the ship is damaged, but the shields "resurrect", all "damage" (red mask) may be hidden until shields are depleted again.