Commit 88f52b7f by BellCodeEditor

save project

parent afe95b1e
Showing with 8 additions and 3 deletions
......@@ -21,13 +21,11 @@ for i in filelist:
if i[-4:] == '.ogg' or i[-4:] == '.wav':
music_list.append(i)
print(music_list)
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
num = -1
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -44,7 +42,6 @@ while True:
if volume < 0:
volume = 0
pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN:
x,y = event.pos
if x > 270 and x < 370 and y > 350 and y < 450 :
......@@ -63,6 +60,14 @@ while True:
pygame.mixer.music.play()
play_button = stop_img
click = 0
if x > 420 and x < 520 and y > 350 and y < 400:
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(path + '\\'+music_list[num])
pygame.mixer.music.play()
play_button = stop_img
click = 0
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(filelist)-1:
......
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