I try to do homework, and I write breakout game. Now,I write the basic function of this game finish.but I want to increase Bonus When ball crash the bonusbricks,I write method to check them and get the color form object that ball crash.
} else if(color == Color.BLACK){
double xBonus = ball.getX() +20;
double yBonus = ball.getY() +20;
remove(ball);
ball = new GOval(xBonus, yBonus, BALL_RADIUS+20, BALL_RADIUS+20);
ball.setFilled(true);
ball.setFillColor(Color.RED);
add(ball);
GObject collider = getCollidingObject();
I use collider to detect the object that ball crash
but when the ball crash the bonus brick. The ball has increase size but collider is detect new ball object to be the bricks and bounce ball though game edge.
Please help me .. Sorry,for my wrong grammatically.