Compare commits

...

1 Commits

Author SHA1 Message Date
Storm Dragon
619cb5508a Learn sound now tells you which item in the list you are on. 2025-03-16 01:20:41 -04:00

View File

@@ -278,6 +278,12 @@ def learn_sounds(sounds):
and (f.split('.')[0].lower() not in ["game-intro", "music_menu"])
and (not f.lower().startswith("_"))]
# Sort the sound files alphabetically
soundFiles.sort()
# Total number of sound files
totalSounds = len(soundFiles)
# Track last spoken index to avoid repetition
lastSpoken = -1
@@ -286,7 +292,8 @@ def learn_sounds(sounds):
while not returnToMenu:
if currentIndex != lastSpoken:
speech.speak(soundFiles[currentIndex][:-4])
# Speak the sound name followed by its position in the list
speech.speak(f"{soundFiles[currentIndex][:-4]}, {currentIndex + 1} of {totalSounds}")
lastSpoken = currentIndex
event = pygame.event.wait()