feat: save highscores
This commit is contained in:
@@ -25,6 +25,7 @@ public class Tetris {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception | Error e) { System.out.printf("%s: %s\n", "Error setting system look and feel", e); }
|
||||
Settings.load();
|
||||
HighScores.load();
|
||||
timer = new Timer("Tetris falling pieces");
|
||||
space = new Space();
|
||||
ui = new TetrisUI();
|
||||
@@ -51,6 +52,7 @@ public class Tetris {
|
||||
|
||||
public static void stopGame() {
|
||||
SoundUtil.stopMusic("/music/theme.wav");
|
||||
HighScores.addScore(space.getScore());
|
||||
if (gravityTask != null) gravityTask.cancel();
|
||||
timer.purge();
|
||||
if (ui.getMenuPanel() instanceof ScoreMenu) ((ScoreMenu) ui.getMenuPanel()).gameOver();
|
||||
|
||||
Reference in New Issue
Block a user