         gameScene.scaleMode = .AspectFill
         skView.presentScene(gameScene)
     }
+    
+    func exitGame() {
+        performSegueWithIdentifier("exitGameSegue", sender: self)
+    }
 
     func receiveEvent(notification: NSNotification) {
         let userInfo = notification.userInfo as! [String: Int]

        let message = "Score: \(score)"
        let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)

        let okAction = UIAlertAction(title: "Ok", style: .Default, handler: { (_) in self.performSegueWithIdentifier("exitGameSegue", sender: self) })
        alertController.addAction(okAction)
        return alertController
    }


    override func viewDidLoad() {
        super.viewDidLoad()
        NSNotificationCenter.defaultCenter().addObserver(self,
                                                         selector: #selector(self.receiveEvent(_:)),
                                                         name: "showAlert", object: nil)
        NSNotificationCenter.defaultCenter().addObserver(self,
                                                         selector: #selector(self.exitGame),
                                                         name: "exitGame", object: nil)
        presentGameScene()
    }

