Hey everyone! So when I made the game that Bucky made with his Swift tutorials, I noticed that the balls fell anywhere between the beginning and end of the screen. The issue with this is the balls can fall behind your character. So I designed a way where the balls only fall in front of the character as shown in the code below (BE AWARE THAT THE VARIABLES I USED MAY BE DIFFERENT THAN THE VARIABLES IN YOUR CODE).


//Create ball node 
    func createBallNode(){
        let ball = SKSpriteNode(imageNamed: "starball.png")
        
        let shooterNode = self.childNodeWithName("shooterNode")
        let shooterPosition = shooterNode?.position
        let shooterWidth = shooterNode?.frame.size.width
        
        ball.position = CGPointMake(randomNumber(shooterPosition!.x + shooterWidth!/3,maximum: self.size.width), self.size.height)
        ball.name = "ballNode"
        ball.physicsBody = SKPhysicsBody(circleOfRadius: ball.size.width/2)
        ball.physicsBody?.usesPreciseCollisionDetection = true
        
        self.addChild(ball)
    }
    
    func randomNumber(minimum: CGFloat, maximum: CGFloat) -> CGFloat{
        
        let minInt = UInt32(minimum)
        let maxInt = UInt32(maximum)
        let result = arc4random_uniform(maxInt - minInt) + minInt
        
        return CGFloat(result)
    }