0

这可能与粒子系统无关,而与分层有关,但是......我有以下粒子系统代码:

CCParticleExplosion *explosion = [[CCParticleExplosion alloc] init];
explosion.texture = [[CCTextureCache sharedTextureCache] addImage:@"blah.png"];
explosion.position = ccp(100,100);
[explosion setAutoRemoveOnFinish:YES];
[explosion setTotalParticles:10];
[self addChild:explosion];
[explosion autorelease];

如果我将该代码像“HelloWorld”场景一样粘贴,它会呈现良好。但是,如果我将代码放在 CCLayer 下,然后将该 CCLayer 添加到“HelloWorld”场景中,则粒子不会出现。这是为什么?(我看到 CCLayer 就好了)

唯一明显的区别是在我的“HelloWorld”场景中,我有一个“world”对象。我什至尝试添加到[self scheduleUpdate]我的 CCLayer 中。

在我的 CCLayer 中,我也有一个空白更新。我应该在这里做点什么吗?

-(void) update:(ccTime)delta{

}

任何帮助,包括良好的一般做法(尤其是内存管理)将不胜感激。(刚开始 cocos/iOS 开发)谢谢!!

4

1 回答 1

1

检查:

  • 质地不是零
  • 纹理不太大(最大 512x512)
  • 纹理具有二维的力量(4、8、16、32 等)
  • 持续时间为正(否则它会自动移除效果)
  • self.visible == 是
  • (self.position + explode.position) == 屏幕上的某处(爆炸的位置被添加到自身的位置,因为它的位置是相对于其父级的)
于 2012-11-14T00:07:24.310 回答