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?

@game_gecko Do you still have issues with this?

I haven’t noticed this problem again, but I think it may have been Xcode. I have updated it to the latest version and only get error like the previous problem when I have too much space.

This topic was automatically closed after 166 days. New replies are no longer allowed.