Commit 60f1c53f by BellCodeEditor

save project

parent 883662d4
Showing with 9 additions and 5 deletions
...@@ -13,8 +13,9 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -13,8 +13,9 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐 # 载入音乐
pygame.mixer.music.load('歌曲4.ogg') # 载入音乐 filelist=["歌曲1.waw","歌曲2.waw","歌曲3.waw","歌曲4.ogg"]
#pygame.mixer.music.load('歌曲4.ogg') # 载入音乐
num=-1
volume = 0.2 volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0
...@@ -40,7 +41,7 @@ while True: ...@@ -40,7 +41,7 @@ while True:
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
if event.button==1: if event.button==1:
x,y=event.pos x,y=event.pos
if x>270 and y>330 and y<430 if x>270 and y>330 and y<430:
click += 1 click += 1
if click % 2 == 0: if click % 2 == 0:
play_button = stop_img play_button = stop_img
...@@ -49,8 +50,11 @@ while True: ...@@ -49,8 +50,11 @@ while True:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
pygame.mixer.music.play() num+=1
if num>len(filelist)-1:
pygame.mixer.music.load(filelist[num])
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