Adding Options to the Menu Scene

Create a new file called OptionsScene.swift.

Next, add in the assets for the Options Scene menu button, mute, unmute, slider base, and slider knob assets from the chapter and add them into the Assets.xcassts file. Add them under the HUD folder as follows:

Adding Options to the Menu Scene

In the OptionsScene class, add the following properties for the texture atlas, mute button, slider base, slider knob, and menu button:

import SpriteKit class OptionsScene: SKScene { // Grab the HUD sprite atlas: let textureAtlas:SKTextureAtlas = SKTextureAtlas(named:"HUD") let muteButton = SKSpriteNode() let sliderBase = SKSpriteNode() let sliderKnob = SKSpriteNode() ...

Get Swift Game Development - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.