Just to make sure I understand you right: you want to display the health of the player by showing hearts on the screen?
I am not sure why you want to name the sprites differently, do the hearts look different?
Assuming that there is only 1 heart sprite, I would approach it like this:
- Load the sprite into whatever scene you want to use it in (I guess making a HUD scene with a control node would be best)
Like this:
const HEART = load('path_to_your_heart')
On the HUD scene create something that can hold and organise the hearts, like a HBoxContainer node.
Now you want to create a function that adds a heart sprite to that HBoxContainer for every point of health the player has.
Something like this:
func add_hearts():
for heart in Lifepoints:
$HBoxContainer.add_child(HEART.instance())
Once you actually play the game, you want to eventually add some more functionality that whenever the player gets hit or gains a lifepoint, that you empty the entire HBoxContainer and then add the hearts again depending on the new amount of lifepoints.
Hope that helps.
P.S. I don't have Godot open in front of me, but I am reasonably sure it would work like that. But you might need to tinker around with it.