Fixed a bug with score sorting.

This commit is contained in:
Storm Dragon 2025-02-14 20:46:38 -05:00
parent 97431c0c74
commit 6d2c6e04d8

View File

@ -61,12 +61,12 @@ class Scoreboard:
read_config() read_config()
self.currentScore = score self.currentScore = score
self.highScores = [] self.highScores = []
try: try:
localConfig.add_section("scoreboard") localConfig.add_section("scoreboard")
except: except:
pass pass
# Load existing high scores # Load existing high scores
for i in range(1, 11): for i in range(1, 11):
try: try:
@ -81,6 +81,9 @@ class Scoreboard:
'name': "Player", 'name': "Player",
'score': 0 'score': 0
}) })
# Sort high scores by score value in descending order
self.highScores.sort(key=lambda x: x['score'], reverse=True)
def get_score(self): def get_score(self):
"""Get current score.""" """Get current score."""