1
votes

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..

1
Did you create the GameScene View on your storyboard? If it's yes, did you connect it to you GameSceneView file?Haox
The scene should have the size of the screen, not the size of the level, since the scene size directly affects the scene's scaleMode. If you need to, you can add a SKNode with that size to the scene and put your level nodes in it.LearnCocos2D

1 Answers

-1
votes

Was able to fix it by making a new LevelSelect : SkScene class.