GameScene
class GameScene : SKScene
The base class for a given level.
Requires
A tile map node called “Tile Map Node”. Automapping should be disabled, and the tileset should be “Costumemaster Default”.Requires
A camera node called “Camera”.Requires
Level configuration data in the scene’s user data. See also:LevelDataConfiguration
.
-
The player node in the level.
Declaration
Swift
var playerNode: Player?
-
The base unit size for a given tile in a level.
Declaration
Swift
var unit: CGSize?
-
The configuration for this level.
Declaration
Swift
var configuration: LevelDataConfiguration?
-
The level’s signal senders.
Declaration
Swift
var switches: [GameSignalSender]
-
The level’s signal responders.
Declaration
Swift
var receivers: [GameSignalReceivable]
-
Interactable objects in the level.
Declaration
Swift
var interactables: [GameHeavyObject]
-
The exit door for this level.
Declaration
Swift
var exitNode: DoorReceiver?
-
A child node that stores the structure of the level.
Declaration
Swift
var structure: SKNode
-
Whether the player has died on this level.
Declaration
Swift
var playerDied: Bool
-
Set up the game scene, parse the tilemapm and start playing music.
Declaration
Swift
override func sceneDidLoad()
-
Run scene-related lifecycle updates.
Declaration
Swift
override func update(_ currentTime: TimeInterval)
-
Run any post-update logic and check input states.
Declaration
Swift
override func didFinishUpdate()
-
Prepare the scene for destruction and save the scene name.
Declaration
Swift
override func willMove(from view: SKView)
-
Call the scene with a given file name.
Declaration
Swift
func callScene(name: String?)
Parameters
name
The file name of the scene to call.
-
Check the state of the inputs.
Declaration
Swift
func checkInputStates(_ event: NSEvent)
-
Check the wall states and update their physics bodies.
Declaration
Swift
func checkWallStates(with costume: PlayerCostumeType?)
Parameters
costume
The costume to run the checks against.
-
Check the state of the doors in the level.
Declaration
Swift
func checkDoorStates()
-
Drop or pickup items near the player.
Declaration
Swift
func grabItems()
-
Get the pause menu screen and load it.
Declaration
Swift
func getPauseScene()
-
Make state updates that inform the player that they have “died”.
Declaration
Swift
func kill()
-
Listen to keyboard events and run the game logic for key events.
Declaration
Swift
public override func keyDown(with event: NSEvent)
-
Listen for keyboard events and halt the player if the movement keys were released.
Declaration
Swift
public override func keyUp(with event: NSEvent)