title: How to make an sprite bounce within an object?
body: <p>I am trying to make a ball bounce within a circle so it cant get out of the circumference of the circle. Now the ball bounce in self.frame. How can I make the ball bounce within the circle?</p>
  
  <pre><code>let sceneBody = SKPhysicsBody(edgeLoopFromRect: self.frame)
      sceneBody.friction = 0
      self.physicsBody = sceneBody
  
      var ball = SKShapeNode(circleOfRadius: 9)
      ball.fillColor = SKColor.whiteColor()
      ball.position = view.center
      ball.physicsBody = SKPhysicsBody(circleOfRadius: 9)
      ball.physicsBody?.affectedByGravity = true
      ball.physicsBody?.restitution = 1
      ball.physicsBody?.linearDamping = 0
      ball.zPosition = 3
      self.addChild(ball)
  
      circulo = SKSpriteNode(imageNamed: "circuloFondo2")
      //Circle that I want the ball bounce within
      circulo.size = CGSize(width:view.frame.size.width - padding , height: view.frame.size.width - padding)
      circulo.color = UIColor(red: 0.15, green: 0.15, blue: 0.15, alpha: 1)
      circulo.colorBlendFactor = 1
      circulo.alpha = 0.35
      circulo.position = view.center
      self.addChild(circulo)
      circulo.zPosition = 1
  </code></pre>