From 89351dd7762f30750055bd1bd854faf4e13a1743 Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Fri, 13 Jan 2023 18:11:08 +0100 Subject: [PATCH] implemented highscore functionality --- src/main/java/Gui/GameGui.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/Gui/GameGui.java b/src/main/java/Gui/GameGui.java index 56cd8d8..dec7129 100644 --- a/src/main/java/Gui/GameGui.java +++ b/src/main/java/Gui/GameGui.java @@ -20,6 +20,7 @@ public static JLabel Headline,QuestionLabel,WinningLabel, LosingLabel, ShowQuest public static JButton AnswersBtn1,AnswersBtn2,AnswersBtn3,AnswersBtn4,RestartBtn,RestartBtn1,ClosingBtn; public static int questionNr = 0; public static int counter = 1; +public static int highScore = 0; GridLayout grid; GridBagConstraints gbc; @@ -175,7 +176,10 @@ GridBagConstraints gbc; @Override public void highScore() { - HighScoreLabel = new JLabel("Hier steht der Highscore"); + if (highScore < questionNr) { + highScore = questionNr; + } + HighScoreLabel = new JLabel("Dein Highscore ist: Frage " + highScore); LosingPanel.add(HighScoreLabel); }