diff --git a/CCBReader/CCBAnimationManager.h b/CCBReader/CCBAnimationManager.h index b61ffcd..9bc85b8 100644 --- a/CCBReader/CCBAnimationManager.h +++ b/CCBReader/CCBAnimationManager.h @@ -95,6 +95,7 @@ - (void) runAnimationsForSequenceNamed:(NSString*)name tweenDuration:(float)tweenDuration; - (void) runAnimationsForSequenceNamed:(NSString*)name; - (void) runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuration; +- (void) stopRunningAnimation; -(void) setCompletedAnimationCallbackBlock:(void(^)(id sender))b; diff --git a/CCBReader/CCBAnimationManager.m b/CCBReader/CCBAnimationManager.m index 15966a0..3cdb6f3 100644 --- a/CCBReader/CCBAnimationManager.m +++ b/CCBReader/CCBAnimationManager.m @@ -510,10 +510,8 @@ - (id) actionForSoundChannel:(CCBSequenceProperty*) channel return [CCSequence actionWithArray:actions]; } -- (void) runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuration +- (void) stopRunningAnimation { - NSAssert(seqId != -1, @"Sequence id %d couldn't be found",seqId); - // Stop actions associated with this animation manager [self removeActionsByTag:animationManagerId fromNode:rootNode]; @@ -523,7 +521,18 @@ - (void) runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDurati // Stop actions associated with this animation manager [self removeActionsByTag:animationManagerId fromNode:node]; - + } +} + +- (void) runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuration +{ + NSAssert(seqId != -1, @"Sequence id %d couldn't be found",seqId); + [self stopRunningAnimation]; + + for (NSValue* nodePtr in nodeSequences) + { + CCNode* node = [nodePtr pointerValue]; + NSDictionary* seqs = [nodeSequences objectForKey:nodePtr]; NSDictionary* seqNodeProps = [seqs objectForKey:[NSNumber numberWithInt:seqId]];