开发者

Cocos2d framework (iPhone): loading 100 frames causes problem

开发者 https://www.devze.com 2023-01-06 16:27 出处:网络
I am developing application in cocos2d framework 0.99. I have 100 images for animation, the image is big so it\'s difficult to load 开发者_JAVA百科how can I get those image catche once and use in the

I am developing application in cocos2d framework 0.99.

I have 100 images for animation, the image is big so it's difficult to load 开发者_JAVA百科how can I get those image catche once and use in the application.

I am using following code:

CCAnimation *walkingAnimation = 
    [CCAnimation animationWithName:@"Flying Animation" delay:1.0f/10];

for (int i=1;i<26;i++) {
    [walkingAnimation addFrameWithFilename:
         [@"night"stringByAppendingString:
             [NSString stringWithFormat:@"%i.png",i]]];
}

CCAnimate *walk = [CCAnimate actionWithAnimation:walkingAnimation];

Anyone knows please help.


You should try using texture atlases. I can't remember Cocos atlas class, but it should be something like CCSpriteAtlas

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号