Dangerous Ground
If printing text brought you to the edge of your seat, hang on tightly. Things will get more exciting when you let players actually start the game. At this point, you should add a file named PlayScene.swift
to your project. Just as GameScene
contains logic for the start screen, PlayScene
is in charge of the game’s main play area. The barebones class should look like this:
import SpriteKitclass PlayScene: SKScene { override func didMoveToView(view: SKView!) { self.backgroundColor = UIColor(hex: 0x80D9FF) }}
After you import SpriteKit, you define PlayScene
as a child class of SKScene
. The didMoveToView
method is just like the one in GameScene
. It fires when the player navigates to the ...
Get Learning Swift™ Programming 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.