I've got a game where if you hit an enemy, you go to the gameover screen. I added a view controller to main.storyboard and made the class GameOver. However, it says I need an entry point and when I load the app it is just a blank screen. The thing is, I dont really need an entry point because I am switching scenes in the code when an enemy collides with the player. No button "entry point" needed. How can this be fixed?


Here is the code for collision with enemy:
func CollisionWithEnemy(Enemy: SKShapeNode, Player: SKSpriteNode) {
    //Highscore
    var ScoreDefault = NSUserDefaults.standardUserDefaults()
    ScoreDefault.setValue(Score, forKey: "Score")
    ScoreDefault.synchronize()
    if (Score > Highscore) {
        var HighscoreDefault = NSUserDefaults.standardUserDefaults()
        HighscoreDefault.setValue(Score, forKey: "Highscore")
    }
    var gameOver:SKScene = GameOver(size: self.size)
    ScoreLabel.removeFromSuperview()
    Enemy.removeFromParent()
    Player.removeFromParent()
    self.view?.presentScene(gameOver, transition: transition)
}

Set a text for your storyboard ID
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With