を使用して必要な場合は、サウンドをプリキャッシュすることができます
はまた、私はちょうどあなたにCCTextureCacheとCCSpriteFrameCacheを使用する方法についてのコードセグメントを与えたいです。テクスチャキャッシュキャッシュの実テクスチャ/イメージとスプライトフレームキャッシュは、テクスチャに関する情報をロードします(スプライトシートをロードしている場合)。 サンプルコードはここにあります。
ここでlatestBurp1-1.pvr.cczとburpParticles1-1.pngはマイスプライトシートで、その情報は(同名の).plistファイルです。
以下の機能では、テクスチャを読み込みますが、spriteFrames(テクスチャに関する情報)も読み込んでいます。
また、pngよりもはるかに高速に読み込むpvrファイルとpvr.cczファイルも見てください。
-(void) loadBurpAnimation {
NSString* burpFile;
NSString* burpFilePVR;
NSString* burpParticlesFile;
NSString* burpParticlesFilePVR;
burpFile = @"latestBurp1-1.plist";
burpFilePVR = @"latestBurp1-1.pvr.ccz";
burpParticlesFile = @"burpParticles1-1.plist";
burpParticlesFilePVR = @"burpParticles1-1.png";
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:burpFile texture:[[CCTextureCache sharedTextureCache] addImage:burpFilePVR]];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:burpParticlesFile texture:[[CCTextureCache sharedTextureCache] addImage:burpParticlesFilePVR]];
NSMutableArray *burpFrames = [NSMutableArray array];
for(int i = 231; i <= 268; ++i) {
[burpFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"burp.%d.png", i]]];
}
burpAnim = [[CCAnimation alloc] initWithFrames:burpFrames delay:0.04f];
[burpFrames removeAllObjects];
//Burp Particles
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:burpParticlesFile];
NSMutableArray *burpParticlesFrames = [NSMutableArray array];
for(int i = 3; i <= 37; ++i) {
[burpParticlesFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"Burp_%05d.png", i]]];
}
burpParticlesAnim = [[CCAnimation alloc] initWithFrames:burpParticlesFrames delay:0.04f];
[burpParticlesFrames removeAllObjects];
}
私はちょうどあなたにいくつかの言葉をgoogleする必要がありますので、多くの情報をくれた。
ありがとうアンドリュー!あなたはまた私の他の質問hahaに答えましたが、あなたはもう少し詳しい情報を提供することができますか?ありがとう;) – Joethemonkey101