只是一个简单的问题,当使用 coocs2d 的 sprite 表和 plist 时,动画是按名称调用每一帧还是遍历图像的行?我遇到了一些帧混淆,它显示了来自不同序列的帧,比如说它在运行时显示了一个跳转帧。任何指针都会有所帮助!
问题似乎是当我添加多个动作时
NSMutableArray *walkAnimFrames = [NSMutableArray array]; //Animation Frames
for (int i=1; i<=6; i++) {
[walkAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"Standing_%d.png",i]]];
}
NSMutableArray *runAnimFrames = [NSMutableArray array];
for (int i=1; i<=11; i++) {
[runAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"Running_%d.png",i]]];
}
NSMutableArray *jumpAnimFrames = [NSMutableArray array];
for (int i=1; i<=12; i++) {
[runAnimFrames addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"rwby_jump%d.png",i]]];
}
CCAnimation *walkAnim = [CCAnimation
animationWithSpriteFrames:walkAnimFrames delay:0.1f]; //Animations
self.walkAction = [CCRepeatForever actionWithAction:
[CCAnimate actionWithAnimation:walkAnim]];
CCAnimation *runAnim = [CCAnimation
animationWithSpriteFrames:runAnimFrames delay:0.1125f];
self.runAction = [CCRepeatForever actionWithAction:
[CCAnimate actionWithAnimation:runAnim]];
CCAnimation *jumpAnim = [CCAnimation
animationWithSpriteFrames:jumpAnimFrames delay:0.1125f];
self.jumpAction = [CCRepeatForever actionWithAction:
[CCAnimate actionWithAnimation:jumpAnim]];