Hi there. I’m working on a 2D platformer and I’m having this issue that I can’t for the life of me figure out a solution to. Basically, I have a health bar which is curved, and I have a mask for that health bar which is the same shape as the health section. There is a rectangle then which only interacts with the mask, and as the health goes down, the rectangle rotates around the health bar, creating a black area to make the health bar deplete. This works fine, until I apply alpha.
When the player is near one of the top corners of the screen where the UI is, I want to apply alpha so I can see where the player is without the UI being bothersome. When the alpha is applied, that black area starts showing the health bar through it. I have been trying for ages today to figure out a way around it, applying shaders and whatnot, but I can’t get it to work as you would want. I would simply want the images flattened down and then the alpha applied to the result, rather than having to apply alpha in this fashion having the colours blend.
What is a practical and functional way of doing this when it comes to 2D? I have seen some solutions and some of them even talk about using another camera with a texture renderer. Nonetheless, I haven’t managed to get any of the solutions to work. It’s interesting, because this sounds like something that should be so easy to solve, yet it’s causing headaches.
Here is an example of what I mean. Without alpha it’s fine, but as soon as I apply alpha, the health bar is visible through the mask.
