Game Development Reference
In-Depth Information
Go ahead and add this snippet to the bottom of the GameScene.init() method and
save your changes. Now run the application one more time. You will now see the Super-
SpaceMan positioned in front of the previously added backgroundNode , as shown in
Figure 1-11 .
Figure 1-11 . The playerNode added to the GameScene
After making these changes, your new GameScene.swift file should look like Listing
1-3 .
Listing 1-3 . GameScene.swift: The modified GameScene.swift
import SpriteKit
class GameScene: SKScene {
let backgroundNode : SKSpriteNode?
var playerNode : SKSpriteNode?
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(size: CGSize) {
Search WWH ::




Custom Search