0
我是新来的cocos2d。任何人都可以给我一个方法来给出一帧到另一帧之间的过渡动画。 这是我的代码取帧和只显示如何在cocos2d中的框架spritesheet之间放置动画?
[[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];
如何做动画帧
感谢之间的过渡提前
在代码=> CCAnimation * walkAnim = [CCAnimation animationWithFrames:walkAnimFrames延迟:0.1F];延迟用于从一帧到另一帧的过渡。请阅读cocos2d的ray wenderlich教程。 – Marine
是啊,我们可以给予延迟,但AWT ABT动画 –
我不知道我知道你想要什么......但要运行动画,只是做'[self.sprite runAction:self.walkAction]' – fiddler