だから私は次のような子供向けゲームを作っています:
Apple、Ball、Cat などの約 118 の異なるCENTER_OBJECTSが中央に配置され、 ALPHABETSがその周りを回転するため、正しいアルファベットをクリックすると移動し、CENTER_OBJECTが置き換えられます。
私が直面している問題は、CENTER_OBJECT の表示フレームが置き換えられると、動き回るアルファベットにわずかな遅れが見られることです。表示フレームを new word のフレームに設定した
ことが原因であると確信しています。
各CENTER_OBJECTのスプライト シートを非同期的にキャッシュしています。では、このわずかな遅れを止めるために提案できる方法はありますか?
編集
プレーヤーがプレイを開始する前に、5 つの中心オブジェクトをキャッシュし、残りのキャッシュ オブジェクトが 2 つだけになったら、次の 5 つのアイテムのキャッシュを開始します。だから私が持っているのはそのための関数です:
-(void)getNext5RandomsForHalf:(NSInteger)half{
int i;
// half is just a way to preload , alternatively 1st half
// or 2nd half is used for cached Center Objects 
if (half==0) {
    i=0;
}else
{
    i=5;
}
for (int j=0; j<5; j++) {
  NSInteger objectIndex;
  do {
        objectIndex=(arc4random()%[self.centerObjects count]);
  } while (playedObjects[objectIndex]==1);
  playedObjects[objectIndex]=1;
  batchRandomObjects[j+i]=objectIndex; // this is used to store precalculated 
                                       //random numbers 
  NSString *tempString = (NSString*)[self.centerObjects objectAtIndex:j];
  NSString *filename = [NSString stringWithFormat:@"%@.plist",tempString];
[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:filename];
CCLOG(@"%@ file added",filename);
    }
    dispatch_async( dispatch_get_main_queue(), ^{
         // Code for Starting the play for the first time . 
         if (justStarted) {
            [self playForNextObjectWithNumberOfLetters:self.numberOfLetters];
            justStarted=NO;
        }
    });
});
}
私の playForNextObjectWithNumberOfLetters: では、ゲーム オブジェクト CenterObject を宣言して初期化し、それに応じて表示フレームを設定します。したがって、表示フレームの目的でオーバーライドされる NSString* centerObjectName というプロパティがあります
-(void)setCenterObjectName:(NSString*)name
{
_centerObjectName = [name retain];
        CCSpriteFrame* frame = [[CCSpriteFrameCache
sharedSpriteFrameCache]spriteFrameByName:_centerObjectName];
self.displayFrame = frame;
}