Apple Game Frameworks and Technologies: Class property redeclared as local (p 115)

On page 115 is this text:

Add a new property named playingLevel to the GameScene class, and give it a default value of false:

var playingLevel = false

Then, at the end of the spawnMultipleGloops() method, set playingLevel to true:

var playingLevel = true

The last line of that is intended to set the class property to true, but instead is redeclaring a new local playingLevel variable and setting that to true.

The last line should perhaps have been

playingLevel = true

1 Like

Hi, David.

Nice catch. The code is correct, but the text is not. That last line should read:

playingLevel = true

Thank you for spotting this error. It’s been fixed—you’ll see the correction in the next release.

2 Likes