Hot answers tagged

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 haven't set the location where the label is supposed to appear in initScoreboard. Do it like that: setLocation(label, x, y);


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.


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