Reputation: 1794
I am new to programming and I am trying to build a simple game using Swift and SpriteKit. It looks good now but I have a little problem to solve. How do I get from a SKScene (Game) to a UIViewController in the Storyboard?
My game looks like this. In the Storyboard i have 3 views (Main menu, About and Game Over) and 1 SKScene (Game). When the player clicks on the play button in the main menu he gets to the game SKScene. When the player fails I want to get to a new UIViewController where I can link 2 buttons (back to main menu and restart).
I don't know how to do this. I will also accept Objective-C if you don't know in Swift.
Upvotes: 3
Views: 1074
Reputation: 13
For others encountering this problem down the road:
self.view?.window?.rootViewController
will return a UIViewController
object when called in a SKScene
.
Upvotes: 1