私の init メソッドでは、このようなアニメーションのフレームを初期化します。
walkingFrames = [NSMutableArray array];
for(int i =2; i<34; i = i+2){
if(i<10){
[walkingFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"Frame-00%d.tif", i]]];
}
else{
[walkingFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"Frame-0%d.tif", i]]];
}
}
where walkingFrames is defined in the header file.
update メソッドでこのようなアニメーションを作成しようとすると、bad_access が発生します。
CCAnimation *walkingAnimation = [CCAnimation animationWithSpriteFrames:walkingFrames delay:animationWalkingSpeed];
self.walkAction = [CCRepeatForever actionWithAction:
[CCAnimate actionWithAnimation:walkingAnimation]];
[_guy runAction:_walkAction];
where walkAction is a CCAction property.
何がうまくいかないのかを解決するのに苦労しています。