我有一系列想要播放的 SKAction,但它们无法正常播放。眼睛只会闭上,再也不会睁开。我不知道为什么会发生这种情况,但也许你会!感谢您的帮助,谢谢。
-(void)blink {
SKAction *delay = [SKAction waitForDuration:3];
SKAction *blinkEye = [SKAction resizeToHeight:1 duration:.2];
SKAction *delay2 = [SKAction waitForDuration:.5];
SKAction *openEye = [SKAction resizeToHeight:3 duration:.2];
SKAction *group1 = [SKAction group:@[delay,blinkEye]];
SKAction *group2 = [SKAction group:@[delay2,openEye]];
SKAction *all = [SKAction sequence:@[group1,group2]];
SKAction *repeat = [SKAction repeatActionForever:all];
[self runAction:repeat];
}
在 MyScene.m 中
-(void)update:(CFTimeInterval)currentTime {
/* Called before each frame is rendered */
Player *player = (Player *)[self childNodeWithName:@"player"];
Player *lefteye = (Player *)[player childNodeWithName:@"leye"];
Player *righteye = (Player *)[player childNodeWithName:@"reye"];
[lefteye blink];
[righteye blink];
}