Renovating the GameScene class

We have made quite a few changes to our project. Luckily, this is the last major overhaul of the previous animation code. Moving forward, we will use the terrific structure we built in this chapter. At this point, your GameScene.swift file should look something like the following:

import SpriteKit class GameScene: SKScene { let cam = SKCameraNode() let ground = Ground() let player = Player() override func didMove(to view: SKView) { self.anchorPoint = .zero self.backgroundColor = UIColor(red: 0.4, green: 0.6, blue: 0.95, alpha: 1.0) // Assign the camera to the scene self.camera = cam // Spawn our test bees: let bee2 = Bee() bee2.position = CGPoint(x: 325, y: 325) self.addChild(bee2) let bee3 = Bee() bee3.position = ...

Get Swift Game Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.