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
}