- Home /
2D | A better way than just to create a ton of sprites.
Hey all.
I am making a 2D arena fighter sort of game, and I am getting to the point where I need to add the weapons.
I was thinking a simple solution would just to be to create lots of sprites and change the player model whenever they pick up a weapon to be a player sprite holding that weapon.
However, this seems very inefficient and time-consuming - as I would need a player sprite for running, jumping, etc for each weapon.
Is there a better way of doing this? Maybe like adding anchor points to all the weapons and the player's hands?
Thanks, and sorry for the vague question title - I didn't know how else to word it.
Answer by FullDefilate · Apr 24, 2019 at 08:51 AM
There are many different solutions to this, and to be able to help i would require a little bit more info. In any case here's some general approaches
As you said you can create many multiple sprites for each different combination.
You could handle the character animations with a character sprite without hands. And have a hand object with its own animations when unarmed.Weapons should have the hands already attached to their respective sprite,and then have the weapon or hands as children of the character. That way the whole character animates independent of the weapons he has equipped.
You could have a character sprite with bones using anima2D. Then you can normally animate it as you would with any 3d object and attach the weapon to the hand bone you want. That way the weapon will move along with the other character animations as the weapon follows the hand bone.
Hope i helped!
I was thinking that a good approach would be, like you said, to animate the body and have the arms following the cursor independently. I was also thinking that when a weapon is picked up/equipped, I could just parent it to the arms. Is their a way to make sure it parents in the same place every time? Or would I have to create an arm/hand object with its own animations like you said?
EDIT: I have decided to go with separate sprites for each weapon + arms, and animate them separately to the body. Thanks for your help!
Glad to help! By the way for the question about placement , you could create your weapon prefabs as children of an empty object so that when you place the weapon to the character, the placement would be on the correct position (as you defined by the children parent relationship of the weapon and its empty parent). Cheers!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How of these two methods are more efficient? 2 Answers
Flip Sprite C# 0 Answers