So, I have been making my MiniLD game and now I face with another problem. I am making a pong clone using slick2d, and when the ball hits my paddle in a certain range, it just goes through it. Here is the code I have (I can't use the intersects()
method because it is an image)
if (ballY >= paddlePlayerY && ballY <= paddlePlayerY + paddlePlayer.getHeight() && ballX <= paddlePlayerX + 10) {
ballVelocity.x = -ballVelocity.getX();
System.out.println("Hit");
}
Edit: I managed to fix that, but now I can get the ball stuck behind the paddle, giving the CPU a load of points.