Commit 4978a939 by BellCodeEditor

save project

parent f633f270
Showing with 3 additions and 3 deletions
...@@ -15,11 +15,11 @@ logo_img = pygame.image.load('logo.png') # 中间logo ...@@ -15,11 +15,11 @@ logo_img = pygame.image.load('logo.png') # 中间logo
#pygame.mixer.music.load('歌曲3.wav') #pygame.mixer.music.load('歌曲3.wav')
#music = ['歌曲1.wav', '歌曲2.wav','歌曲3.wav','歌曲4.ogg'] #music = ['歌曲1.wav', '歌曲2.wav','歌曲3.wav','歌曲4.ogg']
music = [] music = []
path ="C:\Users\admin\Music\my music" path ="C:\\Users\\admin\\Music\\my music"
filelist = os.listdir(path) filelist = os.listdir(path)
for i in filelist: for i in filelist:
if i[-4:] == '.ogg' or i[-4:] == '.wav' : if i[-4:] == '.ogg' or i[-4:] == '.wav' :
music.append(i)
ok = -1 ok = -1
volume = 0.3 volume = 0.3
...@@ -56,7 +56,7 @@ while True: ...@@ -56,7 +56,7 @@ while True:
ok += 1 ok += 1
if ok > len(music)-1 : if ok > len(music)-1 :
ok = 0 ok = 0
pygame.mixer.music.load(music[ok]) pygame.mixer.music.load(path+'\\'+music[ok])
pygame.mixer.music.play() pygame.mixer.music.play()
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment