I\'m using texture atlases in my Sprite Kit game. I\'m creating SKTextureAtlas
object and store it\'s textures in array for each animation. So when I need some
had the same problem and I solved it in my game by not using atlases. So try this example:
-(void)makePlayerAnimation:(SKSpriteNode *)player
{
SKTexture *texture1 = [SKTexture textureWithImageNamed:@"texture1.png"];
SKTexture *texture2 = [SKTexture textureWithImageNamed:@"texture2.png"];
SKTexture *texture3 = [SKTexture textureWithImageNamed:@"texture3.png"];
SKAction *animationTextures = [SKAction animateWithTextures:@[texture1, texture2, texture3] timePerFrame:0.1];
[player runAction:animationTextures];
}
When you wish to activate animation do this:
[self makePlayerAnimation:myNode];
or
[self makePlayerAnimation:self.myNode];
Just depends how you declared it. If you need to run animation forever, you can just add line at the end of previous method:
SKAction *repeat = [SKAction repeatActionForever: animationTextures];
Hope this helps.