スプライトシートから実行しているアニメーションがあります。アニメーションの最後のフレームで、画像がスプライト境界の右下に移動したように見えます。ここにビデオがあります:
コードに問題はありません。問題は、Zwoptex で作成したスプライト シートのプロパティ リストにある可能性があります。プロパティリストは次のとおりです。
https://gist.github.com/1128291
そして関連するソース:
//initialize
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:[images objectForKey:@"elephantPlist"]];
elephantSpritesheet = [CCSpriteBatchNode batchNodeWithFile:[images objectForKey:@"elephantSpritesheet"]];
elephant = [TouchableSprite spriteWithSpriteFrameName:@"elephant_1.png"];
elephant.delegate = self;
[self addChild:elephantSpritesheet];
[elephantSpritesheet addChild:elephant];
.
- (void)animateElephant{
NSArray *frames = [self makeFrameNames:@"elephant" numFrames:15];
CCAnimation *animation = [CCAnimation animationWithFrames:frames delay:0.05f];
CCAnimate *animate = [CCAnimate actionWithAnimation:animation];
[elephant runAction:animate];
}
もう1つ、アニメーションが停止するフレームを変更しても問題は解決しません。つまり、フレーム 1 ~ 15 の代わりにフレーム 1 ~ 10 のみを使用すると、10 番目のフレームは 15 番目と同じように左下にジャンプします。