# Stuck on Cat Nap chapter 9

**URL:** <https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769>\
**Category:** 2D iOS & tvOS Games by Tutorials\
**Created:** [June 21, 2020, 5:33am UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769 "2020-06-21T05:33:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben\_eaton\_goode](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ben_eaton_goode/32/81494_2.png) [@ben\_eaton\_goode](https://forums.kodeco.com/u/ben_eaton_goode)\
**Post date:** [June 21, 2020, 5:33am UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/1 "2020-06-21T05:33:04Z")

</div>

Hi, I finally made it to chapter 9 (intermediate physics) however after entering code on lines 38-40 I’m get getting an errors: ”= Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value” I also tried running the final source code for chapter 10 and the same error appears. Prior to enter those lines of code, I can destroy the blocks but the cat won’t fall. I’m a beginners to programming and having a hard trying to figure this out. Thanks for any solutions.  
 ![image](https://files.chunter.kodeco.com/original/3X/a/e/ae3fd3c7c4d295a726c803dd45361e2c8f4e65c5.jpeg)

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [July 7, 2020, 3:38pm UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/2 "2020-07-07T15:38:24Z")

</div>

@ben_eaton_goode Do you still have issues with this?

---

<div class="post-metadata">

**Author:** ![jeffbls](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jeffbls/32/91482_2.png) [@jeffbls](https://forums.kodeco.com/u/jeffbls)\
**Post date:** [July 12, 2020, 10:54pm UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/4 "2020-07-12T22:54:56Z")

</div>

I did the following to get it to work:

Within CatNode.swift I added the following (points could use some fine-tuning):  
var splinePoints = [CGPoint(x: -80, y: -75),  
CGPoint(x: -90, y: -25),  
CGPoint(x: -20, y: 180),  
CGPoint(x: -90, y: 280),  
CGPoint(x: -20, y: 300),  
CGPoint(x: 80, y: 300),  
CGPoint(x: 175, y: 250),  
CGPoint(x: 100, y: 200),  
CGPoint(x: 135, y: 75),  
CGPoint(x: 120, y: -75),  
CGPoint(x: -80, y: -75)]

```
    let catRoughShape = SKShapeNode(splinePoints: &splinePoints,
                             count: splinePoints.count)
    catRoughShape.lineWidth = 2
    self.physicsBody = SKPhysicsBody(polygonFrom: catRoughShape.path!)
    self.physicsBody!.affectedByGravity = true
    self.physicsBody!.isDynamic = true

```

---

<div class="post-metadata">

**Author:** ![jeffbls](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jeffbls/32/91482_2.png) [@jeffbls](https://forums.kodeco.com/u/jeffbls)\
**Post date:** [July 14, 2020, 12:08am UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/5 "2020-07-14T00:08:32Z")

</div>

As an update to the above post, the y-values need to be adjusted and the physics body should be to parent instead of self to be more consistent with the tutorial.

---

<div class="post-metadata">

**Author:** ![ben\_eaton\_goode](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ben_eaton_goode/32/81494_2.png) [@ben\_eaton\_goode](https://forums.kodeco.com/u/ben_eaton_goode)\
**Post date:** [July 15, 2020, 2:17am UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/6 "2020-07-15T02:17:02Z")

</div>

I just entered your suggested code and the cat fell (The cat has gravity). Thanks a million. Do you have any suggestions on learning SpriteKit for newbie programmers?

---

<div class="post-metadata">

**Author:** ![ben\_eaton\_goode](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ben_eaton_goode/32/81494_2.png) [@ben\_eaton\_goode](https://forums.kodeco.com/u/ben_eaton_goode)\
**Post date:** [July 15, 2020, 2:19am UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/7 "2020-07-15T02:19:57Z")

</div>

No, credit to Jeffbls who gave code that gave the cat gravity. Now onward with rest of the book.

---

<div class="post-metadata">

**Author:** ![jeffbls](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jeffbls/32/91482_2.png) [@jeffbls](https://forums.kodeco.com/u/jeffbls)\
**Post date:** [July 15, 2020, 1:14pm UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/8 "2020-07-15T13:14:50Z")

</div>

Honestly, I usually use the tutorials from this website. They are pretty good most of the time. Looking at other forums, it looks like an update by Apple broke this tutorial (as well as hundreds of other people’s code). It’s an unfortunate side effect of working with a tool kit that is being actively developed.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [April 4, 2021, 12:52am UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/10 "2021-04-04T00:52:14Z")

</div>

Opened on April 4, 2021, 12:52am UTC



---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [April 4, 2021, 12:52am UTC](https://forums.kodeco.com/t/stuck-on-cat-nap-chapter-9/112769/11 "2021-04-04T00:52:37Z")

</div>

@jeffbls Thank you for sharing your solution - much appreciated!
