[英]Image shifts right after animation completes
我有一個從Spritesheet運行的動畫。 在動畫的最后一幀,圖像似乎移動到了精靈邊界的右下角。 這里有一個視頻:
我的代碼找不到任何錯誤; 問題可能出在我用Zwoptex制作的spritesheet屬性列表上。 這是屬性列表:
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幀到第10幀,而不是第15幀,則第15幀將像第15幀一樣向下和向左跳。
我不確定為什么,但是我關閉了Zwoptex中的修整功能,從而解決了該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.