如何重复此动作3次而不是永远重复它 - 精灵套件

时间:2014-06-10 11:10:27

标签: objective-c ios7 sprite-kit objective-c-2.0

如何重复此动作3或2次而不是永远重复

 SKLabelNode *label = [SKLabelNode labelNodeWithFontNamed:@"AmericanTypewriter-Bold"];
 label.text = @"Boom";
 label.fontColor = [SKColor blackColor];
 label.fontSize = 90;
 label.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame)+25);

 SKAction *disappear = [SKAction fadeAlphaTo:0.0 duration:0.2];
 SKAction *appear = [SKAction fadeAlphaTo:1.0 duration:0.2];
 SKAction *pulse = [SKAction sequence:@[disappear,appear]];

 [label runAction:[SKAction repeatActionForever:pulse]];

 [self addChild:label];

1 个答案:

答案 0 :(得分:3)

您需要使用SKAction的{​​{1}}方法documented here

repeatAction:count: