【iOS-Cocos2d游戏开发】精怪缓存和动画缓存

【iOS-Cocos2d游戏开发】精灵缓存和动画缓存合理使用CCAnimationCache动画缓存和CCSpriteFrameCache精灵帧缓

【iOS-Cocos2d游戏开发】精灵缓存和动画缓存

合理使用CCAnimationCache动画缓存和CCSpriteFrameCache精灵帧缓存


 如果有一大批CCSprite要操作,缓存到Cache中比每次都创建要高效很多。

例子:射击游戏,TD 等等




//缓存这个动画 名字叫zhang_1(加入)


//取出这个动画文件(取出动画)

CCAnimation *animation=[[CCAnimationCache sharedAnimationCache] animationByName@"zhang_1"];

通过缓存的模式 可以大大提高内存使用率