Hot answers tagged


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 ...


You haven't set the location where the label is supposed to appear in initScoreboard. Do it like that: setLocation(label, x, y);


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 - ...


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

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