I'm making a game that is a bit like Fruit Ninja classic. Basically, when you fail to click a box three times, you lose. I'm currently working on the GUI, and in the top right corner I want a life counter of sorts, like the one in that game.

Here's an example in Minecraft:

There are probably a few good ways to do this and a lot of bad ways. It would be nice if I could just enter a number somewhere and then it would make some hearts greyed out. A pseudocode example:
func lose_life():
get_node("heart_counter").hearts -= 1
I'm surprised no one has asked about this before. So if anyone has good ideas for how I could make this work, it would be great if you shared them! Thank you.