I'm making a sprite kit game and I'm trying to add SKActions to it, but I have followed every guide I have found and nothing is working. Here is the code that incorporates the actions, right now the actions are supposed to just play once when the game starts, it has a two second delay before anything happens, so I don't miss seeing the animation.
SKAction* jumpAction;
SKAction* kneelAction;
SKAction* runAction;
-(id)initWithSize:(CGSize)size{
if (self = [super initWithSize:size]) {
[self setup];
[self performSelector:@selector(spawnCloud) withObject:nil afterDelay:2.0];
//[self performSelector:@selector(setupCharacter) withObject:nil afterDelay:4.0];
[self setupCharacter];
[self setupActions];
[self createDpad];
[self spawnStartupClouds];
//self.physicsWorld.gravity = CGVectorMake(0.2,-2);
self.physicsWorld.gravity = CGVectorMake(0.2 ,-2);
self.physicsWorld.contactDelegate = self;
}
return self;
}
-(void) setupActions {
SKTextureAtlas* atlas = [SKTextureAtlas atlasNamed:@"jump"];
SKTexture* jumpTex1 = [atlas textureNamed:@"jump1.png"];
SKTexture* jumpTex2 = [atlas textureNamed:@"jump2.png"];
SKTexture* jumpTex3 = [atlas textureNamed:@"jump3.png"];
NSArray* jumpAtlas = @[jumpTex1, jumpTex2, jumpTex3];
SKAction* jumpAtlasAnimation = [SKAction animateWithTextures:jumpAtlas timePerFrame:0.1];
SKAction* wait = [SKAction waitForDuration:2.5];
jumpAction = [SKAction sequence:@[wait, jumpAtlasAnimation,]];
NSLog(@"setupActions");
}
jumpAction
? Is this the exact code? There's a syntax error in your action sequence. – Mick MacCallum