I'm working on a game using Sprite Kit. I have a particle effect that runs when an object collides with another object; however, this particle effect seems to disappear when I add a transition to another SKScene. What's causing this disappearance, and how do I solve this issue?
Edit: By disappear I mean that it does not appear in the current scene when the scene is still transitioning with all the sprites still showing. It has a 2 second time interval, so shouldn't I be able to see it?
Here's the code for the particle effect and scene transition:
- (void)player:(SKSpriteNode *)player didCollideWithEnemy:(SKSpriteNode *)enemy {
Enemy *monster = (Enemy *)enemy;
if(!monster.isMoving){
SKEmitterNode *emitter = [NSKeyedUnarchiver unarchiveObjectWithFile:[[NSBundle mainBundle] pathForResource:@"MyParticle" ofType:@"sks"]];
emitter.position = player.position;
[self addChild: emitter];
isAlive = FALSE;
NSLog(@"Hit");
CrowdedData *crowdedData = [CrowdedData sharedManager];
crowdedData.score = score;
[player removeFromParent];
SKTransition *reveal = [SKTransition fadeWithDuration:2];
GameOver *scene = [GameOver sceneWithSize:self.view.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
[self.view presentScene:scene transition:reveal];
}
}