简体   繁体   中英

black screen on presentScene in SpriteKit with Swift

I am new to Swift and SpriteKit, so not sure if I'm handling the different screens and scenes right..

On this screen you can select levels:

class GameScene : SKScene

        let reveal = SKTransition.crossFadeWithDuration(0.4)
        let nextScene = Level_018(size: CGSize(width: 1050, height: 770))
        self.view?.presentScene(nextScene, transition: reveal)

I you can select Level_018, and when you have completed level 18 I present another SKScene.

class Level_018 : SKScene

    let reveal = SKTransition.crossFadeWithDuration(0.8)
    let scene = GameComplete(size: CGSize(width: 1050, height: 770))
    self.view?.presentScene(scene, transition: reveal)

This works

class GameComplete : SKScene

    let reveal = SKTransition.crossFadeWithDuration(0.8)
    let scene = GameScene(size: CGSize(width: 1050, height: 770))
    self.view?.presentScene(scene, transition: reveal)

But here, when I try to present the GameScene that I stared with, I only get a black screen for some reason..

可以通过创建新的LevelSelect:SkScene类来修复它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM