Cleaning up
I hope that you have absorbed some Swift syntax and gained an overview of Swift and SpriteKit. It is time to make room for our own game; let's clear all of that demo code out! We want to keep a little bit of the boilerplate, but we can delete most of what is inside the functions. To be clear, I do not expect you to understand this code yet. This is simply a necessary step towards the start of our journey.
Firstly, we will remove the Hello, World text from the demo. Open the file GameScene.sks
from the project navigator in Xcode. You will see a gray layout view with Hello, World written in the middle. Simply click anywhere on the Hello, World text and press your delete key to remove it. Make sure you save your file before moving on.
Secondly, please replace all of the code from your GameScene.swift
with the following code:
import SpriteKit class GameScene: SKScene { override func didMove(to view: SKView) { } }
Once your GameScene.swift
looks like the preceding code, you are ready to move on to Chapter 2, Sprites, Camera, Actions! The real fun begins now!