[Game AS1] Breakout Ball Movement

Hi. I have a breakout game that I created following a tutorial.

The problem that I have is the ball movement isn’t very ‘natural’ as it only really moves one way. When the ball hits the paddle it doesn’t bounce off in different directions depending on where it hits the paddle it always bounces off in the same direction.

In most breakout games I’ve seen the ball bounces off the paddle at different angles. I was hoping that someone could perhaps help me with this problem. I would be so grateful.

My ball hit code is as follows.

[LEFT]

MovieClip.prototype.checkWalls = function(pGame) { 

    if (this.x<pGame.left+this._width/2) {
        this.x = pGame.left+this._width/2;
        this.vx *= -1;
    } else if (this.x>pGame.right-this._width/2) {
        this.x = pGame.right-this._width/2;
        this.vx *= -1;
    }

    if (this.y<pGame.up+this._height/2) { 
        this.y = pGame.up+this._height/2;
        this.vy *= -1;
    } else if (this.y>pGame.barLevel-this._height/2) {
        //Determine what happens when ball hits paddle
        var l = bar._x-bar._width/2;
        var r = bar._x+bar._width/2;
                
        if (this.x>l && this.x<r) {
            this.y = pGame.barLevel-this._height/2;
            this.vy *=-1;
        } else {
            pGame.loseLife();
        }
    }
};

[/LEFT]