Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scene is unreachable due to lack of entry points

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?

enter image description here

enter image description here

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)


}
like image 749
Darkstar Avatar asked Jul 16 '15 17:07

Darkstar


Video Answer


1 Answers

enter image description here

Set a text for your storyboard ID

like image 117
Sumit Oberoi Avatar answered Oct 04 '22 15:10

Sumit Oberoi