mercredi 18 mars 2015

Pause game and add flashing text Java

I have this loop



while (true) {
game.update();
view.repaint();
Thread.sleep(DELAY);
}


In the game.update various components of the game have their position changed and those updates are reflected when the repaint() method is called on the view. The view extends JComponent and loops through the game objects and calls their print methods.


What I want to do is have a boolean called nextLevel in the game and if it's true Flash text on the screen for the player to notify them that they're going onto the next level. Maybe flash 4-5 times. Then continue the game. Is this possible? I have been playing around with Thead.Sleep() but this only seems to pause the displaying and in the background the game is still going on.


Any ideas on how to do this?


Aucun commentaire:

Enregistrer un commentaire