Commit 42323a94 by BellCodeEditor

save project

parent 576fd478
Showing with 8 additions and 1 deletions
...@@ -13,6 +13,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -13,6 +13,7 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo logo_img = pygame.image.load('logo.png') # 中间logo
my_font=pygame.font.Font('neuropol.ttf',18) my_font=pygame.font.Font('neuropol.ttf',18)
text=my_font.render('Score:10',True,(0,0,0)) text=my_font.render('Score:10',True,(0,0,0))
c=0
pygame.mixer.music.load('歌曲4.ogg') pygame.mixer.music.load('歌曲4.ogg')
volume=0.2 volume=0.2
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
...@@ -20,7 +21,7 @@ while True: ...@@ -20,7 +21,7 @@ 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 event.type == locals.KEYDDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_UP: if event.key == locals.K_UP:
volume += 0.1 volume += 0.1
if volume > 1: if volume > 1:
...@@ -31,6 +32,12 @@ while True: ...@@ -31,6 +32,12 @@ while True:
if volume < 0: if volume < 0:
volume = 0 volume = 0
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN:
click += 1
if click % 2 == 0:
pygame.mixer.music.unpause()
else:
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