Cocos2d iphone 使用CCParticleSystemQuad的滚动射击明星?

Cocos2d iphone 使用CCParticleSystemQuad的滚动射击明星?,cocos2d-iphone,scroll,particles,Cocos2d Iphone,Scroll,Particles,我的初始化函数代码: NSArray *starsArray = [NSArray arrayWithObjects:@"Stars1.plist", @"Stars2.plist", @"Stars3.plist", nil]; for(NSString *stars in starsArray) { CCParticleSystemQuad *starsEffect = [CCParticleSystemQuad particleWithFile:stars];

我的初始化函数代码:

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];
    }

问题是这些粒子会在几秒钟内出现并完全填满屏幕矩形。但是我需要从一开始就布满星星的天空。

将它们添加到一个层中,隐藏该层,然后在完成所有加载后取消隐藏该层。这样你就可以设置东西,而不是让它立即显示出来


这只是一种方法。另一个想法是在游戏和游戏逻辑过程开始之前将所有图像加载到Cocos中。这样在加载图像时就不会出现暂停和延迟。

根据上的答案,您可以手动更新粒子系统。cocos2d-x中的示例:

CCParticleSystemQuad *particle = CCParticleSystemQuad::create("res/Particles/Stars1.plist");
for (int i = 0; i < 10; ++i) {
    particle->update(.1);
}
CCParticleSystemQuad*particle=CCParticleSystemQuad::create(“res/Particles/Stars1.plist”);
对于(int i=0;i<10;++i){
粒子->更新(.1);
}
您可能需要更改间隔以适应粒子