-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsounds.py
More file actions
31 lines (27 loc) · 1.03 KB
/
sounds.py
File metadata and controls
31 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- encoding: utf-8 -*-
'''Game sounds.'''
from enum import Enum
from pygame.mixer import Sound
class Sounds(Enum):
'''Enum for the game's sounds.'''
GAME_BGM = 'sound/GameSceneBGM.ogg'
WORLD_BGM = 'sound/WorldSceneBGM.ogg'
ELIMINATE_FORMAT = 'sound/eliminate/%d.ogg'
SCORE_LEVEL = ('sound/good.ogg', 'sound/great.ogg', 'sound/amazing.ogg', 'sound/excellent.ogg',\
'sound/unbelievable.ogg')
CLICK = 'sound/click.bubble.ogg'
BOARD_SOUND = 'sound/board.ogg'
CLICK_BUTTON = 'sound/click_common_button.ogg'
MONEY = 'sound/money.ogg'
ICE_BREAKING = 'sound/ice_break.ogg'
@staticmethod
def eliminate(idx):
'''Plays the eliminate sound with given index.'''
Sound(Sounds.ELIMINATE_FORMAT.value%idx).play()
@staticmethod
def score_level(idx):
'''Plays the score level sound with given index.'''
Sound(Sounds.SCORE_LEVEL.value[idx]).play()
def play_sound(sound: Enum):
'''Play sound with given number of loops.'''
Sound(sound.value).play()