上传文件至 ''

This commit is contained in:
206530122 2021-06-17 15:15:58 +08:00
parent a6b8edf5ec
commit 625fad3f4f
1 changed files with 13 additions and 0 deletions

13
音乐音效.txt Normal file
View File

@ -0,0 +1,13 @@
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) # 爆炸音乐