标签: ccparticlesystem

Cocos2D - 粒子跟随发射器而不是停留在它们被释放的位置

在cocos2D中,我目前有一个非常简单的粒子发射器初始化如下:

    turnEmitter = [[CCParticleFlower alloc] init];
    turnEmitter.texture = [[CCTextureCache sharedTextureCache] addImage:@"Pocket.png"];
    [self addChild:turnEmitter z:1];
    turnEmitter.scale = 0.7f;
    turnEmitter.positionType = kCCPositionTypeFree;
Run Code Online (Sandbox Code Playgroud)

它只是直接添加到游戏性层.

这个发射器以这种方式跟随屏幕周围的精灵(在更新方法中发生):

    turnEmitter.position = turnEmblem.position;
Run Code Online (Sandbox Code Playgroud)

现在问题是留在发射器后面的粒子尾部随发射器一起移动,而不是释放的粒子只是停留在它们被释放的位置,这给出了一种非常奇怪和愚蠢的效果.

我想做的是在产生之后颗粒根本不跟随发射器,不幸的是我一直无法找到这样做的方法.

正如你从上面的代码中看到的那样,我已经搜索过了,并且发现人们建议改变发射器的positionType属性,尽管我已经尝试了所有可能性并且它没有解决问题.

有没有人对这可能是什么有任何想法?

particles cocos2d-iphone particle-system ccparticlesystem

5
推荐指数
1
解决办法
3662
查看次数

Cocos2D 2.0删除了ARCH_OPTIMAL_PARTICLE_SYSTEM,如何创建pointparticles?

我正在将我的Cocos2D游戏升级到Cocos2D 2.0-rc23.我发现Cocos2D 2.0已删除ARCH_OPTIMAL_PARTICLE_SYSTEM.

"[FIX]粒子:正确处理预乘图像

Fixed possible memory leak when changing textures.
Examples: Removed ARCH_OPTIMAL_PARTICLE_SYSTEM since PointParticle is no longer supported
Run Code Online (Sandbox Code Playgroud)

"

在我目前的代码中.

CCParticleSystem*emitter = [ARCH_OPTIMAL_PARTICLE_SYSTEM particleWithFile:@"ps.plist"];

我怎么能改变这个?

iphone cocos2d-iphone ccparticlesystem

3
推荐指数
1
解决办法
839
查看次数

CCParticleFire和CCParticleSystemQuad文件未加载

我正在尝试创建像这样的粒子效果:

emitter = [[CCParticleSystemQuad alloc] initWithTotalParticles:45];
[emitter setEmitterMode: kCCParticleModeGravity];
emitter.position = ccp(100, 100);
emitter.texture=[[CCTextureCache sharedTextureCache] addImage:@"fire.png"];
CCParticleFire *fire = [[CCParticleFire alloc]init];
fire.position = ccp(0,0);
[self addChild:fire];
[self addChild:emitter];
Run Code Online (Sandbox Code Playgroud)

我总是得到以下错误:

    013-01-11 17:45:49.263 Jumpy[8945:c07] -[CCFileUtils fullPathFromRelativePath:resolutionType:] : cocos2d: Warning: File not found: fire.png
    2013-01-11 17:45:49.264 Jumpy[8945:c07] cocos2d: CCTexture2D. Can't create Texture. cgImage is nil
    2013-01-11 17:45:49.264 Jumpy[8945:c07] cocos2d: Couldn't add image:fire.png in CCTextureCache
    2013-01-11 17:45:49.265 Jumpy[8945:c07] cocos2d: CCTexture2D. Can't create Texture. cgImage is nil
    2013-01-11 17:45:49.265 Jumpy[8945:c07] cocos2d: Couldn't add image:fire.png in …
Run Code Online (Sandbox Code Playgroud)

cocos2d-iphone ccparticlesystem cctexturecache

2
推荐指数
1
解决办法
2069
查看次数