Group Group Group Group Group Group Group Group Group

Code problem in Xcode for game?

I am up to chapter 9(intermediate physics), and I typed the wakeUp() function for the CatNode.swift file and when running the game, as soon as the cat fell on the ground, there was a fatal error alert! The animation didn’t play the game just froze!

I typed the code correctly, but I didn’t make the code block the same way as in the book. The book puts long code on the next line. I try to put keep it on one line.

This is an example of how the book has the code:

let catAwake = SKSpriteNode(fileNamed:
“CatWakeUp”)!.childNode(withName: “cat_awake”)!

I usually put code like that on one line. So I am not sure if it is a setting in Xcode or something else, but when I copy and paste the code from the resource file for the book, that game runs without any errors?