I've had this old program laying around from when I first started programming, so I decided to optimize it up a little bit.. Everything works great now.. However, I can't get the stinkin' ball to bounce off the paddle. It does funny things sometimes I start up the program, and does absolutely nothing other times I start it (I can go into further detail if needed).. Just to triple check my logic.. here's the method:
public void checkCollision(){ if(ball.x == 5 && (ball.y > paddle1.y && ball.y < paddle1.y+63)) ball.xspeed = -ball.xspeed; if(ball.x == WIDTH - 20 && (ball.y > paddle2.y && ball.y < paddle2.y+63)) ball.xspeed = -ball.xspeed; }
It may have something to do with my use of OOP. I can post more code if necessary