1. ## Collision Detection.

First of all sorry about the double post. In my pong game I need to of course have the paddle reflect the ball. My ball moves by having its velocity in both the x and y axis added onto its current position.

Code:
```if (pongBall.xpos<=ppaddlex+5 && pongBall.ypos-5>=ppaddley-40 && pongBall.ypos-5<=ppaddley){
pongBall.vely=pongBall.vely*-1;
};```
In this piece of code I am trying to test:
1st: if the x cordinate of pong ball = the front part of the paddle.

2nd: If the middle of the pong ball is greater than the lowest part of the paddle.

3rd: If the middle of the pong ball is less than the hightest part of the paddle.

pongBall is a class with its xpos, and ypos and there accompaning velocities name vely and vel x. ppaddle x and y are the upper left corner of the paddle.

Does anyone know why this collision detection wont work. Ive been staring at it for about 2 hours and I just cant figure it out. Sorry if I didn't give enough info please tell me and I will put up more.

2. So create a few more (temporary) variables which give meaningful names to some of the values involved.
Code:
`int paddle_top = ppaddley-40;`
A few more of those, and your if statement will be a lot more readable.

It helps to draw a diagram on paper showing the geometry of the problem to be solved.

4. What?
You can't draw a couple of shapes on a piece of paper and put some coordinates on there?

5. ya I can and did that, But it still seems like it should work. I have all the coordinates correct as far as I can tell.

6. Never mind I did it. I thought that the graph was
---------------------<---- x
|
|
|
|
|<---- -y

when y is realy positive