我將紋理圖集拖入我的項目中。圖片命名正確(「heliani_1-9」) 動畫運行平穩,除了3幀,在白底上顯示爲大紅十字。 (見截圖附後)Sprite套件動畫:圖集錯誤
什麼是錯我的代碼?
乾杯
#import "MRMPlayer.h"
@implementation MRMPlayer
-(instancetype)init
{
self = [super init];
{
[self setupAnimations];
[self runAction:[SKAction repeatActionForever:[SKAction animateWithTextures:self.runFrames timePerFrame:0.5 resize:YES restore:NO]] withKey:@"heli"];
self.name = playerName;
}
return self;
}
-(void) setupAnimations{
self.runFrames = [[NSMutableArray alloc]init];
SKTextureAtlas *heliAtlas = [SKTextureAtlas atlasNamed:@"heli"];
for (int i = 0; i < [heliAtlas.textureNames count]; i++) {
NSString *tempName = [NSString stringWithFormat:@"heliani_%d",i];
SKTexture *tempTexture = [heliAtlas textureNamed:tempName];
if(tempTexture) {
[self.runFrames addObject:tempTexture];
}
}
}
@end
大紅色的X表示在您的地圖集中找不到圖像。確認你的動畫在你的地圖集中有所有的圖像,你認爲你有。 – sangony
我知道,我查了好幾次。他們在那裏,並正確命名。我甚至幾次清理了我的項目,嘗試了重命名的項目,我沒有擺脫它。 http://s7.directupload.net/images/140507/rxv7kwtk.png –
我和我的大眼睛的形象6具有命名不一致:)不知道這可能會導致你所有的問題,但肯定有助於窺探。 – sangony