这个函数什么都不做,大约 30 秒后 fps 开始下降。我想知道我必须做什么才能正确显示 ccparticle。
这是我的代码:
-(void) coccomilk:(CGPoint) p{
CCParticleSystemQuad *milk = [[[CCParticleSystemQuad alloc] initWithTotalParticles:100 ] autorelease];
milk.texture = [[CCTextureCache sharedTextureCache] addImage:@"milk.png"];
milk.emitterMode = kCCParticleModeGravity;
milk.totalParticles = 100;
//milk.particleCount = 100;
milk.life = 0.2f;
milk.lifeVar = 0.1f;
milk.startSize = 32;
milk.startSizeVar = 32;
milk.endSize = 2;
milk.endSizeVar = 0;
milk.angle = 90;
milk.angleVar = 42;
//milk.rotation = 0;
//milk.rotatePerSecond = 0;
//milk.rotatePerSecondVar = 0;
milk.speed = 651;
milk.speedVar= 335.5;
milk.gravity = ccp(0,-2.72);
//milk.blendAdditive = NO;
milk.duration = 0.08;
//milk.blendFunc = (ccBlendFunc) {GL_ONE,GL_DST_ALPHA} ;
milk.emissionRate = milk.particleCount / milk.life;
milk.radialAccel = 0;
milk.radialAccelVar = 0;
milk.tangentialAccel = 0;
milk.tangentialAccelVar = 0;
ccColor4F color = {1.0f,1.0f,1.0f,0.8f};
milk.startColor = color;
milk.startColorVar = (ccColor4F) {0.0f,0.0f,0.0f,0.0f};
milk.endColor = color;
milk.endColorVar = (ccColor4F) {0.0f,0.0f,0.0f,0.0f};
milk.position = ccp(p.x,p.y);
//milk.posVar = 0.0;
milk.sourcePosition = ccp(p.x,p.y);
milk.visible = YES;
[self addChild:milk z:2];
milk.autoRemoveOnFinish = YES;
[milk release];
//[self performSelector:@selector(clearSprite:) withObject:water afterDelay:0.4];
}