2

Irene is right to suggest what she did, but that's not your problem. Your code is detecting a collision between the ball and the score. When it detects the collision, it removes the object, which happens to be the score. Also, since the ball starts out in the same position as the score (maybe a poor design choice in itself) and hides it, the collision is ...


1

You could call the initScoreboard() function to create the new GLabel, like this: GLabel final = initScoreboard(window); setFont(final, "SansSerif-40"); setColor(final, "GREEN"); if (bricks) { setColor(final, "RED"); setLabel(final, "Sorry, you lost!"); } else setLabel(final, "You win! You cleared all bricks!"); setLocation(final, (WIDTH - ...


1

I think this will work: removeGWindow(window, try_again); Let me know in the comments if it doesn't so I can investigate more.


1

Probably the ball hits a brick, the velocity on the y-axis gets inverted and the ball goes down, the ball hits another nearby brick, the velocity on the y-axis gets inverted again and the ball goes up again and so on. I imagine the fix could be a bit difficult to implement but feel free to try! My suggestion is to implement something as follows: 1. if the ...


Only top voted, non community-wiki answers of a minimum length are eligible