我在 cocos2d iPhone 游戏中使用了 CCSpeed 动作。但是总是崩溃。
CCAnimation* animation = nil;
animation = [[CCAnimationCache sharedAnimationCache] animationByName:ATTACK_ANIM];
if(animation)
{
CCAnimate *animAction = [CCAnimate actionWithAnimation:animation];
id speed = [CCSpeed actionWithAction:animAction speed:0.13f];
id calBlock = [CCCallBlock actionWithBlock:^{
//[self updateState:kTileState_Idle];
}];
CCSequence *sequence = [CCSequence actions:speed, calBlock, nil];
[self runAction:sequence];
}
但下面的代码工作正常..但无法改变动画速度。上面的代码有什么问题?
CCAnimation* animation = nil;
animation = [[CCAnimationCache sharedAnimationCache] animationByName:quakeAnim];
if(animation)
{
CCAnimate *animAction = [CCAnimate actionWithAnimation:animation];
id calBlock = [CCCallBlock actionWithBlock:^{
//[self updateState:kTileState_Idle];
}];
CCSequence *sequence = [CCSequence actions:animAction, calBlock, nil];
[self runAction:sequence];
}
这是另一个线程。但没有提供代码解决方案。