2013-10-19 118 views
0

我正在開發一個Spritekit遊戲。SKAction上的EXEC_BAD_ACCESS

我recevie一個EXEC_BAD_ACCESS異常時touchind一個節點i嘗試運行動作

此功能捕獲觸摸

-(void)selectNodeForTouch:(CGPoint)location { 
    SKNode *touchedNode = (SKNode *)[self nodeAtPoint:location]; 
    NSLog(@"touched : %@",touchedNode.name); 

    if([[touchedNode name] isEqualToString:@"piece"]){ 
     Piece *piece = (Piece *)[self nodeAtPoint:location]; 
     if ([piece isRotated]) 
      [piece rotateToFront]; 
     else 
      [piece rotateToBack]; 
    } 
} 

目的片方法rotateBack

-(void)rotateToBack{ 
    SKAction *rotationToBack = [SKAction animateWithTextures:[self animationFrames] timePerFrame:0.11]; 
    [self runAction:rotationToBack withKey:@"rotation-to-back"]; 
    [self setRotated:YES]; 
}; 

[自animationFrames]是一個NSMutable數組,轉換成NSArray與

[self setAnimationFrames:[NSArray arrayWithArray:frames]]; 

最後幀是含一些SKTextures

上動畫執行該執行brokes的NSMutableArray

+0

回答這些問題的幫助? http://stackoverflow.com/questions/19159537/ios-spritekit-animation-does-not-appear – DogCoffee

+0

thx但問題不是動畫不會出現,但應用程序打破 – Alga85

+0

嘗試定義rotationToBack,piece並將諾德視爲伊娃。看來,應用程序在使用之前會發布一些東西。 – RFG

回答

0

Piece

改變這一行:

NSString *imageName = [NSString stringWithFormat:@"%@-1%@",[self baseImageName],imageResolution]; 

NSString *imageName = [NSString stringWithFormat:@"%@-1",[self baseImageName]];