I have the animation like below.
sit animation:
SKTexture *sit1 = [SKTexture textureWithImageNamed:@"sit_1_blur.png"];
SKTexture *sit2 = [SKTexture textureWithImageNamed:@"sit_2_blur.png"];
SKTexture *sit3 = [SKTexture textureWithImageNamed:@"sit_3_blur.png"];
SKTexture *sit4 = [SKTexture textureWithImageNamed:@"sit_4_blur.png"];
SKTexture *sit5 = [SKTexture textureWithImageNamed:@"sit_5_blur.png"];
NSArray *sitPng = @[sit1,sit2,sit3];
NSArray *drinkPng = @[sit3,sit4,sit5];
sitAnimation = [SKAction animateWithTextures:sitPng timePerFrame:0.2];
drinkAnimation = [SKAction animateWithTextures:drinkPng timePerFrame:1];
-(void) takeSit{
[self runAction:sitAnimation completion:^{
[self startDrink];
}];
}
How can I change value every second during startDrink
animation? Like so:
someValue +=0.2;
You need to have this inside your startDrink Animation (I am assuming startDrink is another action defined somewhere),
+ (SKAction *)customActionWithDuration:(NSTimeInterval)seconds actionBlock:(void (^)(SKNode *node, CGFloat elapsedTime))block;
measure the the time passed and update someValue +=0.2; accordingly.
Hope this helps.