# Breakout… Getting the ball reflection X angle when htitting paddle / bricks [duplicate]

Im currently creating a breakout clone for my first ever C# / XNA game. Currently Ive had little trouble creating the paddle object, ball object, and all the bricks. The issue im currently having is getting the ball to bounce off of the paddle and bricks correctly based off of where the ball touches the object. This is my forumala thus far:

if (paddleLocation.Intersects(ballLocation))
{
motion.Y *= -1;

// determine X
motion.X = 1 - 2 * (ballLocation.X - paddleLocation.X) / (paddleLocation.Width / 2);
}


The problem is, the ball goes the opposite direction then its supposed to. When the ball hits the left side of the paddle, instead of bouncing back to the left, it bounces right, and vise versa. Does anyone know what the math equation is to fix this?

change

ballLocation.X - paddleLocation.X


to

paddleLocation.X - ballLocation.X