EDIT: My problem was solved. :)
But I have a doubt, what is the most effective way to wait for something to happen in java?
for example, if I want to wait for a boolean b to be true, does this below work?
while(!b) {}
//stuff to do after wait here
or is it more effective to use a Thread and sleep some time before checking again? Or is there another way?
OLD SOLVED STUFF:
Hey, I'm developing a game in which you control a ball with your mouse and you must avoid hitting some rectangles that keep rising in number. While trying to write the scores to a file, I came across a very strange problem. When I add some lines in my code, to wrtie the score to a file, the collision detection stop working!!