如何在cocos2d中的帧spritesheet之间放置动画?

时间:2012-09-20 10:24:13

标签: iphone cocos2d-iphone

我是cocos2d的新手。任何人都可以建议我为一帧到另一帧之间的过渡提供动画的方法。    这是我的代码来获取帧并只显示

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@“spritesheet.plist”];

    // Create a sprite sheet with the Happy Bear images
    CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"spritesheet.png"];
    [self addChild:spriteSheet];

    // Load up the frames of our animation
    walkAnimFrames = [NSMutableArray array];
    for(int i = 1; i <=7; ++i) {
        [walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"sprite%d.png", i]]];
    }
    CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];

    // Create a sprite for our bear
    CGSize winSize = [CCDirector sharedDirector].winSize;
    self.sprite = [CCSprite spriteWithSpriteFrameName:@"sprite.png"];
    self.sprite.position=ccp(320,480);
    self.sprite.anchorPoint=ccp(1,1);
    self.walkAction = [CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO];

如何为帧之间的过渡做动画

提前致谢

0 个答案:

没有答案