问题
I have tried the following code when trying to transition between scenes in my Sprite Kit project:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
XYZGameScene *gameScene = [[XYZGameScene alloc] initWithSize:CGSizeMake(self.size.width, self.size.height)];
crossFade = [SKTransition fadeWithColor:[UIColor blackColor] duration:2];
[playButtonSprite runAction:changePlayButtonTextureOFF];
if(toGameAction){
[self.scene.view presentScene:gameScene transition:crossFade];
}else{}
}
The problem is, when I press the button that triggers the TRUE
with toGameAction
and the transition begins, the SKActions I have which are moving some objects in the background stop. Which isn't what I want. I am trying to make the transition between the two scenes seamless. As the backgrounds are the same just that one scene is the menu and the other is the actual game.
If you are having trouble with understanding what I am trying to implement, it's essentially when you press the button in Flappy Bird and the background doesn't stop moving through the transition between the menu and the game.
回答1:
SKTransition has a property for this named pausesOutgoingScene that has a default value of YES. All you have to do is set this property to NO.
crossFade.pausesOutgoingScene = NO;
来源:https://stackoverflow.com/questions/24891863/how-to-keep-skactions-running-through-an-sktransition-in-sprite-kit