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

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

Archived errata thread: http://archive.raywenderlich.com/forums/viewtopic.php?f=54&t=24676

On page 256 the collision mask is Decimal 11 but you have binary 00001110, it should be 00001011

On page 276, in the grey box, you are asked why the category mask is set to 43. I think it should be “why is the collision mask set to 43”

Page 631. “MobEntity” -> “FoodEntity”

Page 490.

aniation -> animation

page 299 has the collision mask set to 11 for the seesaw, this makes it collide with the edge which then puts it off centre from the seesawBase. the collision mask should be 3 so that it only collides with the cat and blocks. hope this helps

When I uploaded Xcode version 7.3 the game Drop charge wont’t run. It errors on line 72 with a trap. it worked fine when I was using Xcode version 7.2. I even changed the code for lives as version 7.3 does not support “–” It uses “-+ 1” instead. I am not sure what the problem is. It there a fix for it?

The latest version of Swift doesn’t support the ++ or -- operators anymore. Instead you can write them like this:

// old
x++
// new
x += 1

With Xcode 7.3 update in DropCharge, func playBackgroundMusic(name: String{…} is crashing at self.backgroundMusic.autoplayLooped = true

Crash message: "unexpectedly found nil while unwrapping an Optional value

This works fine with Xcode 7.2.1

See separate thread on this issue for more.

DropCharge Background sound crash solution for xcode 7.3 is:

Firstly to add sounds file properly create a group named sounds and right click on it then click “Add files to” then select sound files .caf .wav etc. from resources. When directly dragging the resources to the environment it did not see the files as it shows the folder with not yellow but blue icon.

Secondly FOR CODİNG PART in the properties creat background music directly by typing

var backgroundMusic = SKAudioNode(fileNamed: “SpaceGame.caf”)

then change the function as

func playBackgroundMusic(){
self.backgroundMusic.autoplayLooped = true
self.addChild(backgroundMusic)
}

Call function in the didMoveToView

If you creat the backgroundMusic in the function instead of properties it crashes.

XCPShowView is deprecated. How do I set XCPlayground.liveView instead? (from p207)

I had this problem too. Try:

XCPlaygroundPage.currentPage.liveView = sceneView

instead!

Thanks for the feedback all! We just released a new version (1.3) that updates the book for Xcode 7.3 / Swift 2.2 and addresses many of these issues. As such, I am closing this thread and starting a new one for v1.3.