Thursday, December 12, 2019

algorithm - Which is the best approach to make a 2D character to be able to use tons of different equipments when in action?


I want to create a 2D game but I'd like to have the character to wear tons of different equipments on different combinations, like a RPG or something.


So let's say the user changes his/her shoulders and pants, this must be shown to the player and all these different equipments must follow the different characters action (hitting, being hit, spelling magic, etc.).


I see a few problems that I'd like to know the best approach/algorithm/architecture to solve.



1 - Sprites or Animations


Should I create different sprites for each equipment in each action animation?


Is it better to just have the equipment sprite and animate it directly on code like rotating and translating (using something like tween on Flash)?


Is there any other better option? (I really don't like the ideas above)


2 - Positions


Let's say during one of the character's move he starts looking directly in front to the player's view but ends his movement showing his right side to the player (like if he swings his sword from one side to the other).


If we consider one part of the user, like his head for example, it starts in front and then turns left.


It means at least 3 different positions for each head equipment (helmet, cap, whatever).


This surely influence the answer of #1 question. How is the best way to achieve that?


3 - Layers



Let's consider a character move where he spins 360 degrees with his arms open. At the beginning of the animation, his right hand is close to the user's view and then, at the middle of the movement, this is probably behind the character's body on the animation.


Whatever is the option on #1 question, you surely needs to use some kind of layer model to make this sprite or animation to starts closer to the player's view and later change to far away from player's view.


Is there any good way to do that?


I know the question is quite long and difficult to understand. Let me know if you think it's better to have some drawings to try to explain which one and I'll try to do that.



Answer



I think it sounds like you are looking for a 2D skeletal animation system perhaps? I don't know of any off-the-shelf systems for that unfortunately, since it has been mostly superseded by the 3D-gfx-but-2D-game trend.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...