• Create Account

### #Actualstein102

Posted 30 March 2013 - 12:11 AM

This is my code for the ball colliding with the paddle in my game. As of right now, if the ball approaches the paddle and hits it on the corner, the ball seems to get trapped inside of the paddle. Any suggestions?

I'm using the Slick2d API if it makes a difference.

		if (ball.ballCircle.intersects(paddle.paddleRect)) {
//left
ball.setDx(-ball.getDx());
}
//Right
ball.setDx(-ball.getDx());
}
//Top
ball.setDy(-ball.getDy());
}
}


### #2stein102

Posted 30 March 2013 - 12:11 AM

This is my code for the ball colliding with the paddle in my game. As of right now, if the ball approaches the paddle and hits it on the corner, the ball seems to get trapped inside of the paddle. Any suggestions?

		if (ball.ballCircle.intersects(paddle.paddleRect)) {
//left
ball.setDx(-ball.getDx());
}
//Right
ball.setDx(-ball.getDx());
}
//Top
ball.setDy(-ball.getDy());
}
}


### #1stein102

Posted 30 March 2013 - 12:10 AM

This is my code for the ball colliding with the paddle in my game. As of right now, if the ball approaches the paddle and hits it on the corner, the ball seems to get trapped inside of the paddle. Any suggestions?

		if (ball.ballCircle.intersects(paddle.paddleRect)) {
//Temporary fix
//left
ball.setDx(-ball.getDx());
}
//Right
ball.setDx(-ball.getDx());
}
//Top