BrickBreaker ゲームでは、ボールとバーの衝突をチェックする次のコードがあります。
if(ball.x + ball.getWidth() > bar.x && ball.x < bar.x + (bar.getWidth()/5)) {
...
}
else if(ball.x + ball.getWidth() > bar.x + (bar.getWidth()/5) && ball.x < bar.x + (2*bar.getWidth()/5)) {
...
}
else if(ball.x + ball.getWidth() > bar.x + (2*bar.getWidth()/5) && ball.x < bar.x + (3*bar.getWidth()/5)) {
...
}
else if(ball.x + ball.getWidth() > bar.x + (3*bar.getWidth()/5) && ball.x < bar.x + (4*bar.getWidth()/5)) {
...
}
else if(ball.x + ball.getWidth() > bar.x + (4*bar.getWidth()/5) && ball.x < bar.x + bar.getWidth()) {
...
}
それでも、ボールがバーに当たらない場合は、衝突が発生したと表示されます。衝突チェックの何が問題になっていますか?