Animate a Stick Figure with Cocos2d, images vs. drawing?
I saw this question on a Cocos2d forum, and I would really like to see the answer, I'm assuming its more likely to get answered here:
I was wondering what would be the best method to go about animating a stick figure running, walking, etc. I need to have a wide and flexible range of motion, so prefer to actually animate multiple lines rather than create premade images and flip through them. Would I use rotation or use trigonometry to figure coordinates from the angle of the moving extremities? Any advice, direction or code snippets would b开发者_JAVA百科e really appreciated!
You could set your own anchor points for each sprite to animate with the rotation- that way you could rotate an arm from the end of the arm just by using rotate instead of doing a lot of complicated math. Setting the anchor point also allows you to translate the sprite along that point instead of its center. Anchorpoint tutorial.
However, I think that it might be easier just to create a lot of images of the stick figure doing all of the actions. I think that n game does this and their character has a lot of animations.
精彩评论