- Swift Game Development(Third Edition)
- Siddharth Shekar Stephen Haney
- 250字
- 2021-07-16 17:37:41
Examining the demo code
Let's quickly explore the demo code. Do not worry about understanding everything just yet; we will cover each element in depth later. At this point, I am hoping you will acclimatize to the development environment and pick up a few things along the way. If you are stuck, keep going! Things will actually get simpler in the next chapter, once we clear away the SpriteKit demo and start on our own game.
Make sure you have GameScene.swift
open in Xcode.
The demo GameScene
class implements some functions you will use in your games. Let's examine these functions. Feel free to read the code inside each function, but I do not expect you to understand the specific code just yet:
- The game invokes the
didMove
function whenever it switches to theGameScene
. You can think of it a bit like an initialize, or main, function for the scene. The SpriteKit demo uses it to draw theHello, World
text to the screen and set up the spinning square shape that shows up when we tap. - There are seven functions involving touch, which handle the user's touch input to the iOS device screen. The SpriteKit demo uses these functions to spawn the spinning square wherever we touch the screen. Do not worry about understanding these functions at this time.
- The
update
function runs once for every frame drawn to the screen. The SpriteKit demo does not use this function, but we may have reason to implement it later.
推薦閱讀
- 圖書(shū)館學(xué)是什么
- 文件、信息商業(yè)化服務(wù)機(jī)構(gòu)建設(shè)研究
- 公共圖書(shū)館文獻(xiàn)信息資源政府采購(gòu)
- 中國(guó)古代圖書(shū)館學(xué)研究
- 檔案保護(hù)技術(shù)
- 高校圖書(shū)館門(mén)戶(hù)網(wǎng)站建設(shè)(谷臻小簡(jiǎn)·AI導(dǎo)讀版)
- 博物館新視覺(jué):博物館管理叢書(shū)
- 李一氓文存(第四卷):古籍整理
- 人文通識(shí)講演錄:人文教育卷
- Hands-On Concurrency with Rust
- 山東圖書(shū)館學(xué)史研究
- 知中16·西南聯(lián)大的遺產(chǎn)
- 構(gòu)筑閱讀天堂:圖書(shū)館服務(wù)設(shè)計(jì)探索
- 中國(guó)古典文獻(xiàn)學(xué)(東北師范大學(xué)文學(xué)院學(xué)術(shù)史文庫(kù))
- 四川文理學(xué)院校史(1976—2016)