Skip to content

Commit c5a87e9

Browse files
committed
Sound effect support for when the correct answer is provided
1 parent 43f7b06 commit c5a87e9

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

config.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ beep_command: beep
2323
#pygame specific options
2424
player_buzzed: ./audio/buzz2.wav
2525
wrong_answer: ./audio/wrong.wav
26+
correct_answer: ./audio/correct.wav
2627
all_wrong: ./audio/hi-ho.wav

game_audio.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,30 @@ def everybody_wrong(self):
1717
return
1818
def wrong(self):
1919
return
20+
def correct(self):
21+
return
2022

2123
class _PygameAudio(_NoAudio):
2224
def __init__(self):
2325
pygame.mixer.init()
2426
buzz_path = config.get("audio", "player_buzzed")
2527
wrong_answer_path = config.get("audio", "wrong_answer")
2628
everybody_wrong_path = config.get("audio","all_wrong")
29+
correct_answer_path = config.get("audio", "correct_answer")
2730

2831
self.player_buzz = pygame.mixer.Sound(buzz_path)
2932
self.wrong_answer = pygame.mixer.Sound(wrong_answer_path)
3033
self.all_wrong = pygame.mixer.Sound(everybody_wrong_path)
34+
self.correct_answer = pygame.mixer.Sound(correct_answer_path)
3135

3236
def beep_for_player(self, i):
3337
self.player_buzz.play()
34-
3538
def wrong(self):
3639
self.wrong_answer.play()
37-
3840
def everybody_wrong(self):
3941
self.all_wrong.play()
42+
def correct(self):
43+
self.correct_answer.play()
4044

4145
class _BeepAudio(_NoAudio):
4246
def __init__(self, beep_command):
@@ -70,3 +74,4 @@ def build_audio_engine():
7074
return _BeepAudio(beep_command)
7175
else:
7276
return _NoAudio()
77+

jeopardy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def run_buzzin_attempts(
249249
buzzed_in_player_id, answered_questions, player_names,
250250
scores, question_score)
251251
state = QUESTION_ANSWERED_RIGHT
252+
audio.correct()
252253
else:
253254
adjust_score_and_save(
254255
buzzed_in_player_id, answered_questions, player_names,

0 commit comments

Comments
 (0)