2
\$\begingroup\$

In my game the player can control a character which can wear items. Now it is not visible but I would like to make it visible like for example in Terraria, Starbound, etc.

In my game a player can only face right or left. (right is the mirrored version of left) Only the character's feet and arms are moving during the game.

Is there a simple way in Unity to stick the sprite of the items to "bones"? (like in 3d modelling) Or how could I implement this "equipment on character" system?

I found some assets but I dont have much money.

Thanks in advance! :)

\$\endgroup\$
1
  • \$\begingroup\$ Related. (not Unity specific) \$\endgroup\$
    – user1430
    Commented Aug 21, 2016 at 15:06

2 Answers 2

2
\$\begingroup\$

The usual way to implement different clothes with two-dimensional sprites is paperdolling.

You have a spritesheet for the "naked" player-character which is fully animated. You then create a separate spritesheet with the exact layout for each piece of equipment. In the game, these spritesheets are drawn on top of each other.

The effort for this is animation_frames * items which means it is not much effort when you have few animations of few items, but increases a lot when you have a lot of both. At some point it will be less work to use full-fledged 3d models. With skeleton-based animation you don't need to animate each item individually so the effort to add a new animation or item does not increase depending on how many items or animations you already have.

\$\endgroup\$
3
  • \$\begingroup\$ The first version would be too much work in my situation. Can you link good tutorials for simple 2D bone system? \$\endgroup\$
    – Tudvari
    Commented Aug 21, 2016 at 17:46
  • 1
    \$\begingroup\$ You can check esotericsoftware.com brashmonkey.com and dragonbones.com for tools that can help you. \$\endgroup\$
    – Felsir
    Commented Aug 21, 2016 at 18:00
  • \$\begingroup\$ @Felsir Those tools seem to use a completely different approach (skeletal animation transferred to 2d sprites). You might want to write an own answer which describes this technique in greater detail. \$\endgroup\$
    – Philipp
    Commented Aug 21, 2016 at 20:11
2
\$\begingroup\$

Besides paperdolling as mentioned by Philipp there are skeletal animation systems for 2D.

The animation is separated from the appearance, thus you create the animation using bones and can map different images on these bones. This way you can have multiple appearances for the same animation. An you only need to create the wardrobe as it should be mapped to the bones. So it takes the least effort to dress you characters.

It is entirely possible to create such a system yourself, however it becomes complex very soon if you want to create more elaborate animations. The general idea is that you define 'bones' that have an anchorpoint and a rotation. The bones are organised in a tree-structure where each child inherits the position and rotation of the parent. Then you create 'keyframes' that store the rotation information related to a time key.

These tools can help you create these animations Spine, Spriter Pro, Dragon Bones (the latter is open source). If you have a look at the various sample videos present for each system you'll get the idea. I believe all of them have runtimes for Unity.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks :D I found these too but I think I will implement the equipment system in some other way. \$\endgroup\$
    – Tudvari
    Commented Aug 23, 2016 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .