0

My code for init function:

NSArray *starsArray = [NSArray arrayWithObjects:@"Stars1.plist", @"Stars2.plist", @"Stars3.plist", nil];
    for(NSString *stars in starsArray) {
        CCParticleSystemQuad *starsEffect = [CCParticleSystemQuad particleWithFile:stars];
        [self addChild:starsEffect z:-1];
    }

The problem is that these particles appear and fully fill the screen rectangle during few seconds. But I need the sky full of stars from the beginning.

Gargo
  • 704
  • 6
  • 16

2 Answers2

1

Add them to a layer, hide the layer, then unhide the layer after everything is done loading. That way you can set stuff up and not have it display right away.

That's just one approach. Another idea is to load all your images into Cocos before game play and game logic processes begin. That way there is no pause and delay while images are loading.

johnbakers
  • 24,158
  • 24
  • 130
  • 258
1

According to the answer at cocos2d starting particles from a specific time in the future , you can manually update the particle system. Example in cocos2d-x:

CCParticleSystemQuad *particle = CCParticleSystemQuad::create("res/Particles/Stars1.plist");
for (int i = 0; i < 10; ++i) {
    particle->update(.1);
}

You may need to change the interval to suit the particles.

Community
  • 1
  • 1
lk_vc
  • 1,136
  • 20
  • 26