Use Mask Transparency On One Object To Progressively Hide Another

Okay, so I’m stumped about how to go about this. I have a half spiral texture on a plane for an HP bar, and I have another plane above it that is going to rotate to slowly cover the spiral as the player’s HP goes down. Problem is, for some reason Mask Transparency isn’t working. This means only the upper plane is the same colour as the background and it’s not masking and making the spiral plane behind it the same colour as the background as it rotates and covers more and more of the spiral plane. I’m doing it this way to keep the interface as minimal as possible, which means no cheating by having another plane behind the spiral to match the top plane’s colour to. Any help would be seriously appreciated. Images enclosed for the intended result.

The way I would do it is to create a new black (0 health) and white (100% health) gradient texture. Use that in a node setup where you use math node to compare that value to the vertex color value. Then plug that into Alpha.
In game set the R,G,B vertex color values to health percentage.

Yeah, you’ve completely lost me there… I have no idea how to even set that up properly, let alone the logic brick half for sending out the HP loss or gain message to affect that. I wanted it to be a mask so that I could just use shape keys to rotate the masking object and reduce the amount of messages being sent back and forth and the amount of work needed.

Josip is talking about this:

Ah, okay. Thank you for the link. I will admit I’m a bit stupid regarding the nodes. I’ll see if this works.