I have a game and in this game , i programed player can pick up an item for use , example "gun", "blade". But this is a trouble, I am thinking about this trouble because if i have many item in game , i must create many animation for character for using item. I want ask people have experience in game 开发者_如何学编程flash development about experience create animation optimize for game :) Thank
There isn't much programming involved with this but here it goes:
You can create a single set of animations for your character which will play while he/she is holding the item. Then create separate sets of animations for the items that will correspond to your character animations.
For example you will have an animation of your character walking as if he/she was holding an object. To create an animation for the character walking while holding a gun, you should use the walking character animation, add the gun, animate the gun, then delete the character animation from the overall animation object.
This way then you add the gun animation to your character animation on the scene and call play on both, both will animate correctly.
One approach would be to create your character animations with a stand-in MovieClip to represent an item in the character's hands. Then whenever you play this animation you can replace that stand-in MovieClip with the item the character actually has equipped.
Well, I suppose you wouldn't be replacing the stand-in so much as make it invisible and then attach the new item to it, but the point is don't put the exact item into the animation ahead of time and just stick it in there on the fly.
精彩评论