# Chapter 14 - Loading a game mess up collision detection

**URL:** <https://forums.kodeco.com/t/chapter-14-loading-a-game-mess-up-collision-detection/112199>\
**Category:** 2D iOS & tvOS Games by Tutorials\
**Created:** [June 15, 2020, 6:10pm UTC](https://forums.kodeco.com/t/chapter-14-loading-a-game-mess-up-collision-detection/112199 "2020-06-15T18:10:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreascla](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/andreascla/32/81494_2.png) [@andreascla](https://forums.kodeco.com/u/andreascla)\
**Post date:** [June 15, 2020, 6:10pm UTC](https://forums.kodeco.com/t/chapter-14-loading-a-game-mess-up-collision-detection/112199/1 "2020-06-15T18:10:00Z")

</div>

I’m almost finished with the chapter but I noticed that after loading a saved game, the collision detection between Arnie and the bugs doesn’t work anymore. The bugs simply bounce away and do not disappear.

I have tried the provided “final” project as well, and it actually shows the same behavior. So either there is a bug(!) still in the code, or the problem is the fact that I’m running Xcode 11.5. I did _not_ upgrade the code to Swift 5 when prompted though.

Any clues? 🙂

Regards,  
Andreas

PS. Thanks for an awesome book!!!

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [June 15, 2020, 11:42pm UTC](https://forums.kodeco.com/t/chapter-14-loading-a-game-mess-up-collision-detection/112199/2 "2020-06-15T23:42:43Z")

</div>

If that bug has lasted this long without detection, I am amazed! But it seems that it is so. Congratulations 👏!

What’s happening is that on reload, the physics delegate isn’t being set, so `didBegin(_:)` in `SKPhysicsDelegate` isn’t being performed.

In `didMove(to:)`, move the line `setupWorldPhysics()` out of the conditional and to the end of the method. It should now work.

P.S. I’m really glad you’re enjoying the book 😌 - I wonder what WWDC will bring us.

---

<div class="post-metadata">

**Author:** ![andreascla](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/andreascla/32/81494_2.png) [@andreascla](https://forums.kodeco.com/u/andreascla)\
**Post date:** [June 16, 2020, 7:49am UTC](https://forums.kodeco.com/t/chapter-14-loading-a-game-mess-up-collision-detection/112199/3 "2020-06-16T07:49:45Z")

</div>

Thanks a lot for your help, that makes a lot of sense! Yes, I was almost certain I had missed something, so I was really surprised to find it also in the “final” project. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [November 29, 2020, 10:10am UTC](https://forums.kodeco.com/t/chapter-14-loading-a-game-mess-up-collision-detection/112199/4 "2020-11-29T10:10:01Z")

</div>

Closed on November 29, 2020, 10:10am UTC

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