2014-03-06 3 views
1

간단한 애니메이션으로 노드를 만들려고합니다. 따라서 각 개별 프레임을 .png 파일로 만든 애니메이션을 모든 폴더에 붙였습니다. 그것을 stoneanimation2.atlas라고 명명했다.TextureAtlas 도구가 읽지 않습니다. 텍스처 아틀라스 - SpriteKit 텍스처 아틀라스 생성기 오류

이것은 내가 노력 코드는 다음과 같습니다

SKTextureAtlas *atlas = [SKTextureAtlas atlasNamed:@"stoneanimation2"]; 


    SKTexture *stone2 = [atlas textureNamed:@"stone2.png"]; 
    SKTexture *stone3 = [atlas textureNamed:@"stone3.png"]; 
    SKTexture *stone4 = [atlas textureNamed:@"stone4.png"]; 
    SKTexture *stone5 = [atlas textureNamed:@"stone5.png"]; 
    SKTexture *stone6 = [atlas textureNamed:@"stone6.png"]; 
    SKTexture *stone7 = [atlas textureNamed:@"stone7.png"]; 
    SKTexture *stone8 = [atlas textureNamed:@"stone8.png"]; 
    SKTexture *stone9 = [atlas textureNamed:@"stone9.png"]; 
    SKTexture *stone10 = [atlas textureNamed:@"stone10.png"]; 
    SKTexture *stone11 = [atlas textureNamed:@"stone11.png"]; 
    SKTexture *stone12 = [atlas textureNamed:@"stone12.png"]; 
    SKTexture *stone13 = [atlas textureNamed:@"stone13.png"]; 
    SKTexture *stone14 = [atlas textureNamed:@"stone14.png"]; 
    SKTexture *stone15 = [atlas textureNamed:@"stone15.png"]; 
    SKTexture *stone16 = [atlas textureNamed:@"stone16.png"]; 
    SKTexture *stone17 = [atlas textureNamed:@"stone17.png"]; 
    SKTexture *stone18 = [atlas textureNamed:@"stone18.png"]; 
    SKTexture *stone20 = [atlas textureNamed:@"stone20.png"]; 
    SKTexture *stone21 = [atlas textureNamed:@"stone21.png"]; 
    SKTexture *stone22 = [atlas textureNamed:@"stone22.png"]; 
    SKTexture *stone23 = [atlas textureNamed:@"stone23.png"]; 
    SKTexture *stone24 = [atlas textureNamed:@"stone24.png"]; 
    SKTexture *stone25 = [atlas textureNamed:@"stone25.png"]; 
    SKTexture *stone26 = [atlas textureNamed:@"stone26.png"]; 
    SKTexture *stone27 = [atlas textureNamed:@"stone27.png"]; 
    SKTexture *stone28 = [atlas textureNamed:@"stone28.png"]; 

    NSArray *atlasTexture = @[stone2,stone3,stone4,stone5,stone6,stone7,stone8,stone9,stone10,stone11,stone12,stone13,stone14,stone15,stone16,stone17,stone18,stone20,stone21,stone22,stone23,stone24,stone25,stone26,stone27,stone28]; 

    stoneAnimation = [SKAction animateWithTextures:atlasTexture timePerFrame:.01]; 

그것은 내가 약 10 프레임을했을 때, 이전했다. 그러나 나는 더 추가하기로 결정하고, 엑스 코드는 "SpriteKit 텍스처 아틀라스 발전기 오류"이 오류 메시지가 말한다 때문에, 그것은 아틀라스 자체에 뭔가를 엉망 생각 :

Command /Applications/Xcode.app/Contents/Developer/Tools/../usr/bin/TextureAtlas failed with exit code 11 

나는 완전히 새로운 만들 때마다 아틀라스, 또는 그냥 이름 바꾸기, 그 작동하는지 확인하려면, 나는 같은 오류가 발생합니다. 또한 빌드 설정에서 "Enable Atlas Generator"를 "YES"로 설정했습니다. 그리고 나는 IOS 시뮬레이터를 재설정하려고 시도했다. 그리고 내가 생각할 수있는 모든 것들! 도와주세요!

+0

내 코드와는 아무 상관이 없었 : 바로 텍스처 아틀라스를 클릭하고 추가를 클릭 한해야했다 모두. 그것은 내 코드와 관련이 없습니다. – user3386154

+0

동일한 오류가 있습니다. 어떻게 해결할 수 있는지 말해주세요. – User1234

+0

텍스처 맵을 제대로 가져 오지 못했습니다. 올바르게 가져 오기 전에 변경했기 때문에 생각했습니다. 그래서? 프로젝트 네비게이터의 텍스처 맵에 의해. 어떤 코드도 변경할 필요가 없었습니다. 제가 한 것은 텍스처 맵을 마우스 오른쪽 버튼으로 클릭하고 클릭 : 소스 컨트롤> 선택한 파일 추가입니다. – user3386154

답변

0

속성 추가 NSArray * _stoneFrames;

-(void)addObject 
{ 
    NSMutableArray *stoneAnimationFrames = [NSMutableArray array]; 
    SKTextureAtlas *stoneAnimatedAtlas = [SKTextureAtlas atlasNamed:@"stoneanimation2"]; 
    int numImages = stoneAnimatedAtlas.textureNames.count; 
    for (int i=1; i <= numImages; i++) { 
    NSString *textureName = [NSString stringWithFormat:@"stone%d", i]; 
    SKTexture *temp = [stoneAnimatedAtlas textureNamed:textureName]; 
    [stoneAnimationFrames addObject:temp]; 
    } 
_stoneFrames = stoneAnimationFrames; 
SKTexture *temp = _stoneFrames[0]; 
_stone = [SKSpriteNode spriteNodeWithTexture:temp]; 
[self addChild:_stone]; 
[self animateStone]; 
} 

-(void)animateStone 
{ 
     [_stone runAction:[SKAction repeatActionForever: 
        [SKAction animateWithTextures:_stoneFrames 
            timePerFrame:0.1f 
             resize:NO 
             restore:YES]] withKey:@"animated Stone"]; 
    return; 
} 

또한 내 텍스처 아틀라스에 너무 많은 큰 이미지를했을 때이 오류가 나에게 무슨 일이 블로그 게시물 http://www.raywenderlich.com/45152/sprite-kit-tutorial-animations-and-texture-atlases

1

을 체크 아웃 할 수 있습니다. 두 개의 별도의지도 책으로 나누어서 게임을 잘 만들었습니다.

1

텍스쳐 아틀라스가 제대로 임포트되지 않았다는 것을 알아 냈습니다. 제대로 가져 오기 전에 가져온 것이기 때문에 생각했습니다. 그래서? 프로젝트 네비게이터의 텍스처 맵에 의해. 어떤 코드도 변경할 필요가 없었습니다. 제가 한 것은 텍스처 맵을 마우스 오른쪽 버튼으로 클릭하고 클릭 : 소스 컨트롤> 선택한 파일 추가입니다.

그것은 다른 사람이이 오류가 발생하는 경우, 나는 그것이 일어나는 이유를 파악

관련 문제