September 2018
Intermediate to advanced
434 pages
8h 47m
English
We will attach our new emitter to the Player node, so the emitter will create new white circles wherever the player flies. We can easily reference the emitter design we just created in the editor from our code. Open GameScene.swift and add this code at the bottom of the didMove function:
// Instantiate a SKEmitterNode with the PierrePath design: if let dotEmitter = SKEmitterNode(fileNamed: "PierrePath") { // Position the penguin in front of other game objects: player.zPosition = 10 // Place the particle zPosition behind the penguin: dotEmitter.particleZPosition = -1 // By adding the emitter node to the player, the emitter moves // with the penguin and emits new dots wherever the player is player.addChild(dotEmitter) ...Read now
Unlock full access