Commit 305794b2 by BellCodeEditor

save project

parent d33d4085
Showing with 18 additions and 8 deletions
......@@ -15,11 +15,13 @@ pygame.mixer.music.load('歌曲2.wav')
pygame.mixer.music.load('歌曲3.wav')
pygame.mixer.music.load('歌曲4.ogg')
pygame.mixer.music.load('Sleep Away.mp3')
#pygame.mixer.music.load('Maid with the Flaxen Hair.mp3')
pygame.mixer.music.load('Maid with the Flaxen Hair.mp3')
volume=0.5
Click=0
play_button=stop_img
pygame.mixer_music.set_volume(volume)
music_list=['歌曲2.wav','歌曲3.wav','歌曲4.ogg','Sleep Away.mp3','Maid with the Flaxen Hair.mp3']
num=-1
while True:
for event in pygame.event.get():
......@@ -37,15 +39,23 @@ while True:
volume=0
pygame.mixer_music.set_volume(volume)
if event.type==locals.MOUSEBUTTONDOWN:
Click=Click+1
if Click % 2==0:
pygame.mixer_music.unpause()
play_button=stop_img
else:
pygame.mixer_music.pause()
play_button=play_img
if event.button==1: #-判断开关是否按下
#print(0) ################
x,y=event.pos #-判断开关是否按下
if x>270 and x<370 and y>330 and y<450: #-判断开关是否按下
Click=Click+1
if Click % 2==0:
pygame.mixer_music.unpause()
play_button=stop_img
else:
pygame.mixer_music.pause()
play_button=play_img
if pygame.mixer_music.get_busy()==False:
num+=1
if num > len(music_list)-1:
num=0
pygame.mixer_music.load(music_list[num])
pygame.mixer_music.play()
# 绘制画面
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