In Java, I have a game and the way it runs is the following:
public void start(){
startGame();
}
Now I want that every time the game is over, to rerun the game again after the user clicks on the screen of the game. I have objects in the game, and I would prefer not to remove them one by one, but if it is possible to remove all the created objects altogether and to rerun the game again. Is this possible and if yes, can anybody show me any way please?
In this button-based memory game, a
javax.swing.Timeranimates the opening screen. Pressing the Start button halts the timer and invokesresetGame(). When a game is won, the buttons are reset and the timer resumes.