不同的游戏场景

时间:2015-10-07 13:17:02

标签: swift sprite-kit

我正在开发的游戏有一个奇怪的错误。当点击button0时,isInChallange等于false,当点击button1时,则isInChallange等于true。所以在de GameViewController.swift文件中,我正在使用这段代码:

PM>  dnx ef migrations add Update1 -c "ContextAContext"
PM>  dnx ef migrations add Update1 -c "ContextBContext"

当isInChallange == false时,一切正常,但如果确实如此,我会收到这个令人讨厌的错误:

if isInChallange == false {

    if let scene = GameScene(fileNamed:"GameScene") {
        // Configure the view.
        let skView = self.view as! SKView
        //skView.showsFPS = true
        //skView.showsNodeCount = true
        self.canDisplayBannerAds = true

        /* Sprite Kit applies additional optimizations to improve rendering performance */
        skView.ignoresSiblingOrder = true

        /* Set the scale mode to scale to fit the window */
        scene.scaleMode = .AspectFill

        skView.presentScene(scene)
    }
    }
    if isInChallange == true {
        print("cmon")

        if let scene = challangeScene(fileNamed: "SecondGameScene") {
        let skView = self.view as! SKView
        self.canDisplayBannerAds = true
        skView.ignoresSiblingOrder = true
        skView.presentScene(scene)
        }
    }

真的很感激任何帮助!谢谢!

0 个答案:

没有答案