I have two sequences that need to run sequentially. They are triggered by different parts of the code, so I can't embed the second sequence in the first sequence. Here's the reduced scenario.
CGPoint deltaPos = {-150,0};
id shootArrow = [CCMoveBy actionWithDuration:3 position:deltaPos];
id seq1 = [CCSequence actions:shootArrow, nil];
[sprite1 runAction:seq1];
CGPoint deltaPos2 = {150,0};
id moveSprite = [CCMoveBy actionWithDuration:3 position:deltaPos2];
id seq2 = [CCSequence actions: moveSprite, nil];
[sprite2 runAction:seq2];
I've tried various approaches to no avail -- the sequences either start simultaneously, or I get deadlock.
- Approach 1:
NSLock* mLock, and embed at the start and end of the CCSequence calls to acquire and release the locks.
- Resulting problem:
seq2 results in deadlock.
- Approach 2:
seq2 with [NSThread detachNewThreadSelector]
- Resulting problem:
Would someone point me in the right direction? Muchos gracias.