I personally find closure’s hard to read. I’m talking about the closure waitForDurationThenRunBlock(duration:120)
when processing the balls collision with a brick.
Instead I added these properties to the class:
let hideBrick = SCNAction.hide()
let wait2Minutes = SCNAction.wait(duration: 120)
let showBrick = SCNAction.unhide()
Then in physicsWorld(_:didBegin:):
switch contactNode.physicsBody?.categoryBitMask {
case ColliderType.brick.rawValue:
game.score += 1
contactNode.runAction(.sequence([hideBrick, wait2Minutes, showBrick]))
So my question is, is there a performance hit for writing the code this way?
Thanks in advance! Love the book. Also I wish you guys would do more tutorials on macOS programming.