How to display multiple "sprites" or animations for the same object at the same time?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By tomodachii

I have a character that can be equipped with different weapons in each hand, but I don’t want to create a new sprite for every instance (a sprite for when he has weapon A in the left hand and no weapon in the right hand, a sprite for when he has weapon B in the right hand and no weapon in the left hand, a sprite for when he has weapon A in both hands, etc.) because I feel like this would complicate things when I have to code every situation, so I thought of dividing the character in two and making instances of the character holding and using each item but only displaying half their body, figuring I could find a way of displaying two “halves” of the character depending on which item he should be holding in which hand.

I then made a Sprite node with 3 animation players, 1 for the normal or idle sprite with no weapons and the other two are one for each weapon, and tried testing if it’d display correctly with the following code:

func _process(delta):
	if left_hand == "staff":
		$Sprite/StaffAttacks.play("Idle")
	if right_hand == "sword":
		$Sprite/SwordAttacks.play("Idle")

But only the last animation is displayed (SwordAttacks), I figured if I made the other half transparent the animations would stack on top of each other because both of them should be displaying, right?

Is there a proper way of doing this, dividing a character’s sprite and displaying different animations or parts of what should be the complete sprite at the same time through the script?

Sorry if the question is a bit convoluted, I’m new to this and this is the first time I post here. Thanks in advance.