+1 vote

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.

in Engine by (13 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.