Iphone 动画完成后图像立即移动
我有一个动画,我正在从一个精灵表运行。在动画的最后一帧,图像似乎移动到精灵边界的右下角。这里有一段视频: 我找不到我的代码有任何错误;问题可能出在spritesheet属性列表上,这是我用Zwoptex创建的。以下是属性列表: 及有关资料来源:Iphone 动画完成后图像立即移动,iphone,cocos2d-iphone,zwoptex,Iphone,Cocos2d Iphone,Zwoptex,我有一个动画,我正在从一个精灵表运行。在动画的最后一帧,图像似乎移动到精灵边界的右下角。这里有一段视频: 我找不到我的代码有任何错误;问题可能出在spritesheet属性列表上,这是我用Zwoptex创建的。以下是属性列表: 及有关资料来源: //initialize [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:[images objectForKey:@"elephantPlist"]]; e
//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];
还有一件事,更改动画停止的帧并不能解决问题。也就是说,如果我只使用第1帧到第10帧而不是第15帧,那么第10帧将向下跳到左边,就像第15帧那样。我不知道为什么,但我在Zwoptex中关闭了修剪,这解决了问题
- (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];
}