Errata for 2D iOS & tvOS Games by Tutorials v1.3

This topic is for bugs, typos, and other mistakes in 2D iOS & tvOS Games by Tutorials v1.3.

I have asked a question there over a week ago with no reply

Bug report by Gionata R: "At page 424 you provide the source code that interprets the accelerometer’s input. This piece of code, in my case, had been generating a strong reference cycle with its parent class, so that when I wanted to transition into another scene, my GameScene’s deinit wouldn’t be called.

I solved the problem by adding the [unowned self] capture list before the parameter list “accelerometerData, error in”"

Submitted to our customer support desk by Billy:

Typo, 2D Apple Games, page 203

First, windWithTimer does not exist.
Second, there shouldn’t be an ‘s’ after switchWindDirections(_:slight_smile:

There is a typo in the following paragraph on page 90 of 2D Apple Games by Tutorials v.2.0:

Here, you create the reverse of the actionMidMove and actionMove actions by calling reversed() on each, and insert them into the sequence.

insert should be inserting

Page 525: There is an additional || os(tvOS) needed in update(_ ) in the update camera section.

#elseif os(OSX)

#elseif os(OSX) || os(tvOS)

typo Page 40 (ePub)


instead of “image”

Bug introduced by recommended code on Page 409 (PDF).

Then, in GameScene, replace didMove(to:) with this code:

override func didMove(to view: SKView) {
  if gameState == .initial {
    if firebugCount > 0 {
      createBugspray(quantity: firebugCount + 10)
    gameState = .start

There’s a line within the setupWorldPhysics() method that sets the GameScene class as the SKPhysicsContactDelegate. Since this was moved into a code block that only runs when the gameState == .initial then, when loading a saved game, the physics contact checking done in didBegin(contact:) is no longer firing, therefore you can’t eradicate Bugs in loaded saved games.

I resolved this by moving the following line out of the setupWorldPhysics() and put it right before setupCamera() in GameScene’s didMove(to:) so that it’s always run:

physicsWorld.contactDelegate = self