Commit 8b300661 by BellCodeEditor

save project

parent 4bbd0fb5
Showing with 22 additions and 0 deletions
...@@ -17,12 +17,34 @@ pygame.mixer.music.set_volume(volume) ...@@ -17,12 +17,34 @@ pygame.mixer.music.set_volume(volume)
start = stop_img start = stop_img
click = 0 click = 0
volume = 0.1
pygame.mixer.music.set_volume(volume)
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:
exit() exit()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
pygame.mixer.music.play() pygame.mixer.music.play()
if event.type == locals.KEYDOWN:
if event.key == locals.K_UP:
volume = volume+0.111111111111
pygame.mixer.music.set_volume(volume)
if event.key == locals.K_DOWN:
volume = volume-0.111111111111
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 = stop_img
pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False:
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