forked from gdgunnars/Tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsounds.py
More file actions
52 lines (45 loc) · 2.22 KB
/
sounds.py
File metadata and controls
52 lines (45 loc) · 2.22 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from pygame.mixer import Sound
class Sounds():
"""A class to store all sounds in Tetris."""
def __init__(self):
"""Initialize Sounds."""
# Music
self.title_music = Sound('sounds/music/title_music.ogg')
self.a_type_music = Sound('sounds/music/a_type_music.ogg')
self.b_type_music = Sound('sounds/music/b_type_music.ogg')
self.c_type_music = Sound('sounds/music/c_type_music.ogg')
self.high_score_music = Sound('sounds/music/high_score_music.ogg')
# Sound Effects
self.board_land_after_clear = Sound('sounds/sound_effects/board_land_after_clear.ogg')
self.clear_line = Sound('sounds/sound_effects/clear_line.ogg')
self.game_over = Sound('sounds/sound_effects/game_over.ogg')
self.game_over_wall = Sound('sounds/sound_effects/game_over_wall.ogg')
self.level_up = Sound('sounds/sound_effects/level_up.ogg')
self.move_sideways = Sound('sounds/sound_effects/move_sideways.ogg')
self.option_select = Sound('sounds/sound_effects/option_select.ogg')
self.pause = Sound('sounds/sound_effects/pause.ogg')
self.rotate = Sound('sounds/sound_effects/rotate.ogg')
self.shape_land = Sound('sounds/sound_effects/shape_land.ogg')
self.switch_option_screen = Sound('sounds/sound_effects/switch_option_screen.ogg')
self.tetris_clear = Sound('sounds/sound_effects/tetris_clear.ogg')
self.set_volume()
def set_volume(self):
"""Set volume of Sounds."""
self.title_music.set_volume(.75)
self.a_type_music.set_volume(.75)
self.b_type_music.set_volume(.75)
self.c_type_music.set_volume(.75)
self.high_score_music.set_volume(.75)
self.level_up.set_volume(.75)
self.board_land_after_clear.set_volume(.75)
self.clear_line.set_volume(.75)
self.game_over.set_volume(.75)
self.game_over_wall.set_volume(.75)
self.level_up.set_volume(.75)
self.move_sideways.set_volume(.75)
self.option_select.set_volume(.75)
self.pause.set_volume(.75)
self.rotate.set_volume(.75)
self.shape_land.set_volume(.75)
self.switch_option_screen.set_volume(.75)
self.tetris_clear.set_volume(.75)