When the ball hits the paddle, determine the angle of reflection:
(paddle.x is the center of the paddle in this case)
n# = (ball.x - paddle.x) / (paddle.length/2)
That will return a float from -1 to +1.
If 180 degrees points straight up from the paddle:
angle = 180 + 65*n#
This will give us an angle from 115 to 245. Now store this direction as a vector
ball.vx = sin(angle)
ball.vy = cos(angle)
Move your ball like so:
ball.x = ball.x + ball.vx*ball.speed
ball.y = ball.y + ball.vy*ball.speed
Then, if you hit a side wall or the side of a brick, invert the X direction:
if ball hits side of something then ball.vx = -ball.vx
And do the same thing for
ball.vy if you hit the top or bottom of something.
"You're all wrong. You're all idiots." ~Fluffy Rabbit