So my idea is have a special bullet that freezes the enemies, and after a period of time the enemies unfreeze itself and continue with their actions/animations. Here's a simple version of what I did:
-(void)update:(ccTime)dt
{
CCSprite *enemySprite;
CCARRAY_FOREACH(enemies, enemySprite)
{
if (CGRectIntersectsRect(_bullet.boundingBox, enemySprite.boundingBox))
{
_bullet.visible = NO;
[enemySprite pauseSchedulerAndActions];
enemySprite.pausingDuration = CACurrentMediaTime() +5;
}
if (CACurrentMediaTime() > enemySprite.pausingDuration)
[enemySprite resumeSchedulerAndActions];
}
}
Now, the problem I think I am encounter is that enemySprite has stop updating its scheduler here, so next time the update method is called the enemySprite that has been paused won't get update! I wish I knew a better way of explaining this, but I think any expert programmer would see what's wrong with this code immediately. Please help me out with suggestions to improve the code or even just an idea would be appreciated, thank you for your time.