Adding another scene to our game
Create the GameScene
file as we did for MenuScene
:
import SpriteKit class GameScene: SKScene { let backgroundNode = SKSpriteNode(imageNamed: "BG") override func didMoveToView(view: SKView) { addBackGround() } func addBackGround() { backgroundNode.zPosition = 0 backgroundNode.size = CGSize(width:self.size.width, height:self.size.height) addChild(backgroundNode) } override func update(currentTime: NSTimeInterval) { } }
The code is self-explanatory, we added only a background to the GameScene
, the same as what we did for the MenuScene
.