MainMenuScene

class MainMenuScene : SKScene, GKGameCenterControllerDelegate

The scene class for the main menu.

  • The label node for the word “The”.

    Declaration

    Swift

    var labelSmall: SKLabelNode?
  • The label node for the title.

    Declaration

    Swift

    var labelTitle: SKLabelNode?
  • The sprite node with the character.

    Declaration

    Swift

    var character: SKSpriteNode?
  • The label node for the “Start Game” button.

    Declaration

    Swift

    var startButton: SKLabelNode?
  • The label node for the “Resume Game” button.

    Declaration

    Swift

    var resumeButton: SKLabelNode?
  • The label node for the “Options” button.

    Declaration

    Swift

    var optionsButton: SKLabelNode?
  • The label node for the “Quit Game” button.

    Declaration

    Swift

    var quitButton: SKLabelNode?
  • The Game Center sprite node for the Game Center dashboard.

    Note

    This should only be used in older versions of macOS. In macOS 11.0, the GKAccessPoint is used instead.

    Declaration

    Swift

    var gameCenterButton: SKSpriteNode?
  • The sprite node for the Watch Your Step DLC.

    Declaration

    Swift

    var watchYourStepButton: SKSpriteNode?
  • The level of interactivity from this scene.

    Declaration

    Swift

    var interactiveLevel: Int
  • Whether to set character attributes for this scene.

    Declaration

    Swift

    var setCharacterAttributes: Bool
  • Instantiate the Game Center access point.

    In macOS 11.0, this will use the native access point and put it in the bottom left. For older versions, a sprite node will be used to present a game center view.

    Declaration

    Swift

    func setUpGameCenterProperties()
  • Set up the Game Center button for the main menu.

    Declaration

    Swift

    override func didMove(to view: SKView)
  • Set up the scene and play the main menu music.

    Declaration

    Swift

    override func sceneDidLoad()
  • Dismiss the Game Center view controller when done.

    Declaration

    Swift

    func gameCenterViewControllerDidFinish(_ gameCenterViewController: GKGameCenterViewController)
  • Listen for mouse events and trigger the appropriate menu action.

    Declaration

    Swift

    override func mouseDown(with event: NSEvent)
  • Listen for mouse events and update the character attributes.

    Declaration

    Swift

    override func rightMouseDown(with event: NSEvent)
  • Run post-update logic to refresh scene properties.

    Declaration

    Swift

    override func didFinishUpdate()