Game Development Reference
In-Depth Information
let transition
= SKTransition.doorsOpenHorizontalWithDuration(2.0)
let gameScene = GameScene(size: size)
view?.presentScene(gameScene, transition: transition)
}
As you look at this method, you will see that it creates a doorsOpenHorizont-
alWithDuration transition and a new instance of the GameScene and then presents
the new GameScene using the new transition. Add this method to the bottom of the
MenuScene class and run the application again. This time, when the game is over and
you are presented with the MenuScene , tap the screen, and you will be able to play an-
other game.
Summary
In this chapter, you learned how to implement scene transitions using Sprite Kit's
SKTransition class. You looked at some of the different types of built-in transitions
Sprite Kit makes available to you. You also saw how you could control each scene during
a transition. At the end of the chapter, you took your new knowledge of scene transitions
and added a menu scene to your SuperSpaceMan game.
In the next chapter, you will be wrapping up your study of Sprite Kit programming with
Swift when you focus on Sprite Kit best practices. At the end of the chapter, you will
spend just a little time cleaning up the SuperSpaceMan application when you do some re-
factoring.
Search WWH ::




Custom Search