SKTexture返回错误的大小?

Dvo*_*ole 0 ios ios7 sprite-kit

我有一个图像图集,它们是80乘80.但SKTexture说有些帧是33x80,尽管它们显然是80x80.怎么了?我的动画运行时看起来非常错误.

这是代码:

SKTextureAtlas *myAtlas = [SKTextureAtlas atlasNamed:@"my"];
NSInteger numberOfImages = [run.textureNames count];

NSLog(@"atlas: %@", myAtlas);

for (int i = 0; i < numberOfImages; i++) {
    NSString *textureName = [NSString stringWithFormat:@"walk%.2d", i];
    SKTexture *temp = [myAtlas textureNamed:textureName];
    [self.runningFrames addObject:temp];
}
Run Code Online (Sandbox Code Playgroud)

记录返回:

<SKTextureAtlas> 'my' 16 textures:
 (
    "<SKTexture> 'walk00.png' (33 x 80)",
    "<SKTexture> 'walk01.png' (80 x 80)",
    "<SKTexture> 'walk02.png' (33 x 80)",
... omitted
)
Run Code Online (Sandbox Code Playgroud)

这是为什么?我的动画完全失控,它从一侧移到另一侧,等等.

Dvo*_*ole 6

我找到了问题的解决方案.我正在使用方法制作动画

[self.player runAction:[SKAction repeatActionForever:[SKAction animateWithTextures:self.runningFrames timePerFrame:0.05 resize:NO restore:YES]] withKey:@"playerRunning"];
Run Code Online (Sandbox Code Playgroud)

将调整大小更改为YES可以解决所有问题.