我有一个图像图集,它们是 80 x 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];
}
日志记录返回:
<SKTextureAtlas> 'my' 16 textures:
(
"<SKTexture> 'walk00.png' (33 x 80)",
"<SKTexture> 'walk01.png' (80 x 80)",
"<SKTexture> 'walk02.png' (33 x 80)",
... omitted
)
这是为什么?我的动画完全失控,它从一边移动到另一边,等等。