You can create 3 instance variables: redHearts, maxRedHearts, soulHearts
On red heart pick up, set redHearts to min(redHearts+1, maxRedHearts)
On soul heart pick up, add 1 to soulHearts.
.
When character is hit:
If soulHearts>0, subtract 1 from soulHearts.
If soulHearts=0, check if redHearts>0, subtract 1 from redHearts.
If both redHearts and soulHearts are zero, character dies.