【发布时间】:2012-04-24 08:36:38
【问题描述】:
所以我每秒都在创建一个精灵,但现在我想用 spriteSheetAnimation 替换这个精灵。但是当我运行此代码时,我的应用程序崩溃了:
- (void)spawnCat {
CCSpriteBatchNode *spriteSheet2 = [CCSpriteBatchNode batchNodeWithFile:@"AnimBulle.png"];
[self addChild:spriteSheet2];
// Load up the frames of our animation
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for(int i = 1; i <= 8; ++i) {
[walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"AnimBulle%d.png", i]]];
}
CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames
delay:0.1f];
[target runAction:_walkAction];
target.tag = 1;
[_targets addObject:target];
[self addBoxBodyForSprite:target];
[spriteSheet2 addChild:target z:0 tag:1];
id actionMove = [CCMoveTo actionWithDuration:actualDuration
position:ccp(240, 160)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self
selector:@selector(spriteDone:)];
[target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];
}
【问题讨论】:
-
什么样的崩溃?控制台的输出是什么?
-
我不知道,因为我总是有一个错误 no enough frames in stack 所以我看不到控制台中有什么:/
标签: iphone xcode animation crash cocos2d-iphone