Hi guys, and I really need some help down here (sorry if I'm bothering you, but everyone has to start in making games, right?)

Here are the variables involved in the problem:

[Counter] Health
[Counter] Shield

So, I set that every time the enemies' projectile hits my player, it subtracts x amount of HP. But then this shield idea came into my mind, but the problem is, I don't know how to implement such system.

The system that I'm talking about, is that if projectile hits me with x amount of damage, it would affect the Shield, not the Health. But if the Shield doesn't have any more value/number, the projectile will deal damage into Health instead.

I'm trying to combine 2D Shooter-RPG and 2D Platform, it's going to be Sci fi now ...