官术网_书友最值得收藏!

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 toward the start of our journey.

Firstly, we will remove the Hello, World text from the demo. Open the GameScene.sks file 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 file with the following code:

import SpriteKit

class GameScene: SKScene { 
    override func didMove(to view: SKView) { 
    } 
} 

Once your GameScene.swift file looks like the preceding code, you are ready to move on to Chapter 2, Sprites, Camera, Actions! The real fun begins now!

主站蜘蛛池模板: 杭锦后旗| 桃江县| 兴文县| 庆元县| 璧山县| 宁城县| 保靖县| 普宁市| 玉门市| 兴化市| 乳山市| 保定市| 富裕县| 富裕县| 如东县| 宜黄县| 东阿县| 宜阳县| 桐庐县| 芜湖县| 红桥区| 石城县| 新郑市| 宁安市| 竹北市| 宁强县| 平果县| 鹿邑县| 海兴县| 普兰县| 新蔡县| 东丽区| 高安市| 馆陶县| 阿克陶县| 肇州县| 准格尔旗| 涞源县| 咸丰县| 黔东| 常熟市|