The Start Screen

To build the tic-tac-toe game in Chapter 5, you imported image assets and referenced them in code. You’ll create similar references for each of the assets that you imported in the previous section. You can begin with the play button. Define the resource as a constant in GameScene.swift, like this:

import SpriteKitclass GameScene: SKScene {    let playButton = SKSpriteNode(imageNamed:"play")    override func didMoveToView(view: SKView) {        self.playButton.position = CGPointMake(CGRectGetMidX(self.frame),                                   CGRectGetMidY(self.frame))        self.addChild(self.playButton)        self.backgroundColor = UIColor(hex: 0x80D9FF)    }    override func touchesBegan(touches: ...

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.