I am creating a game where character jumps and collect points (SOME OBJECT). When you tap character perform some animation from atlas. When it touches the points, score is increased by 1. I am using SKTexture to create physicbody of the character. When my character touches the point it crashes and show me this error
fatal error: unexpectedly found nil while unwrapping an Optional value
//Code
Cat = SKSpriteNode(imageNamed: "cat");
Cat.size = CGSize(width: 100, height: 100)
Cat.position = CGPoint(x: self.frame.width/2, y: self.frame.height/2)
//physics
Cat.physicsBody = SKPhysicsBody(texture: SKTexture(imageNamed: "cat"), size:CGSizeMake(100, 100))
But if i create Physicsbody from rectangle or circle it works just fine. Maybe its to do with atlases i am using to animate my character.
Cat.physicsBody = SKPhysicsBody(circleOfRadius: self.frame.width/2)
When the character touches the mushroom it crashes. Working Demo: https://github.com/nak1b/demo-game-error