2
我想創建粒子效果是這樣的: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];
我總是得到以下錯誤:
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 CCTextureCache
這是否意味着沒有圖像?
太棒了!奇怪的是,它在任何書籍或教程中都沒有提到。 – bluestunt
我的書是這麼說的! ;)第9章:「[...]所有內置的粒子效果都嘗試加載一個名爲fire.png的特定紋理,該紋理在Resources/Images文件夾中與cocos2d-iphone一起發佈,您仍然可以創建非常好的粒子效果沒有紋理,只要顆粒尺寸保持相當小,但要按照預期的方式查看內置顆粒效果,則需要將fire.png圖像添加到Xcode項目中。「 – LearnCocos2D
這麼多的密切閱讀.... – bluestunt