I want to create a starry sky for some scenes. The main problem is it needs some time to fill all the screen with particles. Someone advices me to create the whole sky at the beginning and save it between its calls. I tried something like this:
@implementation StarrySky
static StarrySky *_starrySky;
- (id)init
{
if ((self = [super init])) {
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:-2];
}
}
return self;
}
+ (StarrySky *)sharedStarrySky
{
if (!_starrySky) {
_starrySky = [[StarrySky alloc] init];
}
return _starrySky;
}
- (void)dealloc
{
_starrySky = nil;
[super dealloc];
}
@end
But the particles stop moving.