Cocos2d与CCAnimationCache的使用

Cocos2d与CCAnimationCache的使用,animation,cocos2d-iphone,memcached,Animation,Cocos2d Iphone,Memcached,我想了解CCAnimationCache的用法 我有很多敌人的东西。每个对象有两个cAnimations成员变量,一个标准动画和一个特殊动画。动画中的帧根据敌方对象的类型属性而变化 @interface EnemyEntity : Entity { EnemyTypes type; CCAnimation * animation; CCAnimationCache * animationCache; } 通常情况下,在屏幕中,我确实有几个相同类型敌人的实例,我想知道是否

我想了解CCAnimationCache的用法

我有很多敌人的东西。每个对象有两个cAnimations成员变量,一个标准动画和一个特殊动画。动画中的帧根据敌方对象的类型属性而变化

@interface EnemyEntity : Entity
{
    EnemyTypes type;
    CCAnimation * animation;
    CCAnimationCache * animationCache;
}
通常情况下,在屏幕中,我确实有几个相同类型敌人的实例,我想知道是否应该使用CCAnimationCache而不是CCAnimation成员变量


如果是这样的话,我应该把CCAnimationCache实例放在哪里呢。你不看标题里的评论吗

/** Singleton that manages the Animations.
 It saves in a cache the animations. You should use this class if you want to save your animations in a cache.

 Before v0.99.5, the recommend way was to save them on the CCSprite. Since v0.99.5, you should use this class instead.

 @since v0.99.5
 */
此注释位于
CCAnimationCache.h
文件中。因此,这是一个cocos2d单例(CCTextureCache、CCSpriteFrameCache)。如果你想用,就打电话给我

CCAnimationCache* animationCache = [CCAnimationCache sharedAnimationCache];

哦,天哪,我读过了,但没意识到那是一个单身汉。哇!这比我想象的要容易得多:)。谢谢