Commit 70dad8ad by BellCodeEditor

save project

parent f1c21f3e
Showing with 10 additions and 1 deletions
...@@ -18,12 +18,12 @@ filllist=os.listdir(path) ...@@ -18,12 +18,12 @@ filllist=os.listdir(path)
for i in filllist: for i in filllist:
if filllist[-4:]==".wav" or ".ogg": if filllist[-4:]==".wav" or ".ogg":
music.append(i) music.append(i)
print(music)
volume = 0.2 volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0
play_button = stop_img play_button = stop_img
num=-1 num=-1
num1=0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -53,6 +53,14 @@ while True: ...@@ -53,6 +53,14 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if x>120 and x<220 and y>350 and y<400:
num1-=1
if num1<0:
num1=len(music)-1
pygame.mixer.music.load(path+"\\"+music[num1])
click=0
play_button=stop_img
pygame.mixer.music.play()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num+=1 num+=1
...@@ -60,6 +68,7 @@ while True: ...@@ -60,6 +68,7 @@ while True:
num=0 num=0
pygame.mixer.music.load(path+"\\"+music[num]) pygame.mixer.music.load(path+"\\"+music[num])
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