Kodeco Forums

Video Tutorial: Beginning SpriteKit Part 7: Collision Detection

Learn about collision detections in SpriteKit.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3876-beginning-spritekit/lessons/8

Hey, there is no video for this part

Yeah, you are right. I am looking forward the video too.

Hi :slight_smile:

If you are going to make updates for this section, then you should check Challenge documentation.
There’re some mistakes:

  1. Instead of function → func zombieHit(cat: SKSpriteNode)
    there should be → func zombieHit(_ sprite: SKSpriteNode) and inside this function use “sprite” not “cat”;

  2. I guess there’re some future code snippet in func moveTrain(), which aren’t working now

→ if trainCount >= 15 && !gameOver {
gameOver = true
print(“You win!”)
backgroundMusicPlayer.stop()
// 1
let gameOverScene = GameOverScene(size: size, won: true)
gameOverScene.scaleMode = scaleMode
// 2
let reveal = SKTransition.flipHorizontal(withDuration: 0.5)
// 3
view?.presentScene(gameOverScene, transition: reveal)
}

Ok, I’m ready for the next video :slight_smile:

Hi. Thanks for letting us know. We updated the course materials. =]

Hello everybody :slight_smile:

I have followed every step in this video as well as the challenge part. However, my code sets error such as “Property “self.catMovePointsPerSEc” not initialized at super.init call”.

Could you help me with this manner?

I am only a beginner so I may have a tendency to miss some points.

Thank you!

enumerateChildNodes(withName: “cats”){ node, _ in

…}
I am failing the comprehend the closure code above
what is passed in closure with underscore _ ?

@sachin_develper You use the wildcard pattern for the closure’s stop condition because you don’t need it and ignore it in this case.

Please check out the method’s documentation when you get a chance and let me know if you have any more questions or issues about the whole thing:

https://developer.apple.com/documentation/spritekit/sknode/1483024-enumeratechildnodes

Thank you! :]

@hoangapetuska Please check out the finished challenge folder for this video tutorial when you get a chance and let me know if you have any other questions or issues regarding the whole thing. Thank you! :]