2
以下を実行するCCAnimationHelperクラスを作成しました。あなたはそれにfileName、frameCount、およびDelayを与え、アニメーションを返します。私が知りたいのは、アニメーションのフレームをフレーム1で始めるのではなく、代わりにフレーム10で始めるということです。ここに私のコードでありませんcocos2dでアニメーションのフレームを設定する方法
// Creates an animation from sprite frames.
+(CCAnimation*) animationWithFrame:(NSString*)frame frameCount:(int)frameCount delay:(float)delay
{
// load the ship's animation frames as textures and create a sprite frame
NSMutableArray* frames = [NSMutableArray arrayWithCapacity:frameCount];
for (int i = 1; i < frameCount; i++)
{
NSString* file = [NSString stringWithFormat:@"%@%i.png", frame, i];
CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
CCSpriteFrame* frame = [frameCache spriteFrameByName:file];
[frames addObject:frame];
}
// return an animation object from all the sprite animation frames
return [CCAnimation animationWithFrames:frames delay:delay]; //Is there another method I should be using here to set the frame
}