Commit 427b2beb by BellCodeEditor

save project

parent 65196e42
Showing with 19 additions and 19 deletions
...@@ -26,28 +26,28 @@ while True: ...@@ -26,28 +26,28 @@ while True:
exit() exit()
# 按键,控制声音大小 # 按键,控制声音大小
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_UP:
volume += 0.1
if volume > 1:
volume = 1
pygame.mixer.music.set_volume(volume)
if event.key == locals.K_DOWN:
volume -= 0.1
if volume < 0:
volume = 0
pygame.mixer.music.set_volume(volume)
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 x<370 and y>350 and y<450: if x>270 and x<370 and y>350 and y<450:
if event.key == locals.K_UP: click += 1
volume += 0.1 if click % 2 == 0:
if volume > 1: play_button = stop_img
volume = 1 pygame.mixer.music.unpause()
pygame.mixer.music.set_volume(volume) else:
if event.key == locals.K_DOWN: play_button = play_img
volume -= 0.1 pygame.mixer.music.pause()
if volume < 0:
volume = 0
pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN:
click += 1
if click % 2 == 0:
play_button = stop_img
pygame.mixer.music.unpause()
else:
play_button = play_img
pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
pygame.mixer.music.play() pygame.mixer.music.play()
......
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