 
         pipe2 = SKSpriteNode(texture: pipe2Texture)
 
-        pipe2.position = CGPoint(x: CGRectGetMaxX(self.frame) + self.frame.size.width, y: CGRectGetMidY(self.frame) - pipe2Texture.size().height / 2 - gap / 2 + offset)
+        pipe2.position = CGPoint(x: CGRectGetMidX(self.frame) + self.frame.size.width, y: CGRectGetMidY(self.frame) - pipe2Texture.size().height / 2 - gapHeight / 2 + offset)
         pipe2.runAction(moveandRemove)
 
         pipe2.physicsBody = SKPhysicsBody(rectangleOfSize: pipe2Texture.size())

        pipe2.physicsBody?.collisionBitMask      = ColliderType.Object.rawValue

        self.addChild(pipe2)
    }
}

    func addPipes() {
        let pipe1Texture    = SKTexture(imageNamed: "pipe1.png")
        let pipe2Texture    = SKTexture(imageNamed: "pipe2.png")
        let gapHeight       = bird.size.height * 3
        let updown          = CGFloat(arc4random() % UInt32(self.frame.size.height / 2))
        let offset          = updown - self.frame.size.height / 4

