SKSpriteNode will not be fadeInWithDuration using SKAction in the Sprite Kit sequence

Im starts 3 SKActions in sequence, the first two start just fine, but fadeInWithDuration does not disappear in the node, and the node is just added right after the view is loaded. Should I set the source alpha channel for node to 0? Can anyone help with the problem?

- (void)setUpButtonStart { SKSpriteNode *buttonStart = [SKSpriteNode spriteNodeWithImageNamed:@"start"]; buttonStart.name = @"buttonStart"; buttonStart.position = CGPointMake(900,50); [self addChild:buttonStart]; SKAction *wait = [SKAction waitForDuration:2.5]; SKAction *readIntro = [SKAction playSoundFileNamed:@"intro.mp3" waitForCompletion:NO]; SKAction *fadeIn = [SKAction fadeInWithDuration:1.0]; SKAction *sequence = [SKAction sequence:@[wait, readIntro, fadeIn]]; [buttonStart runAction: sequence]; } 
+6
source share
1 answer

As stated in the documentation , the fadeInWithDuration action changes the alpha node property from its current value to 1.0 (100% opacity).

So that you do not notice that you did not notice, your action will not actually do anything, since the default alpha value of the node is 1.0, it will go from 100% to 100%.

As Steffen said in his comment, all you have to do is set buttonStart.alpha = 0.0 before the action is completed.

+18
source

All Articles