14 lines
485 B
Plaintext
14 lines
485 B
Plaintext
class GameSound(object):
|
|
def __init__(self):
|
|
pygame.mixer.init() # 音乐模块初始化
|
|
pygame.mixer.music.load("./feiji/bg2.ogg")
|
|
pygame.mixer.music.set_volume(0.5) # 声音大小 一半
|
|
|
|
self.__bomb = pygame.mixer.Sound("./feiji/bomb.wav")
|
|
|
|
def playBackgroundMusic(self):
|
|
pygame.mixer.music.play(-1) # 开始播放背景音乐
|
|
|
|
def playBombSound(self):
|
|
pygame.mixer.Sound.play(self.__bomb) # 爆炸音乐
|