Hearts and health in game

I'm making this game that has maximum of three hearts and the actor looses a heart every time it touches the enemy... I got this part working, but now I also want the character to earn back a heart every time he finds a bottle of vitamins. If the game already has three hearts earned then I don't want the actor to gain any additional hearts, only 3. How do I accomplish the part of stopping earning hearts when it already got 3? Please help. Thank!
Comments