Commit 70cc92e9 by BellCodeEditor

auto save

parent 51413712
Showing with 15 additions and 5 deletions
......@@ -16,6 +16,8 @@ logo_img = pygame.image.load('logo.png') # 中间logo
volume=0.6
#加载音乐文件
pygame.mixer.music.load("歌曲4.ogg")
click=0
play_button=stop_img
while True:
for event in pygame.event.get():
if event.type==locals.QUIT:#判断事件类型是否为退出事件QUIT????
......@@ -27,11 +29,19 @@ while True:
volume=1#音量设为1
#设置播放音乐的音量
pygame.mixer.music.set_volume(volume)
#判断是否按下down键
#声音减0.1
#判断音量是否小于0
#音量设为0
#设置播放音乐的音量
if eventkey==lucals.KDOWN: #判断是否按下down键
volume-=1 #声音减0.1
if volume<0: #判断音量是否小于0
colume=0 #音量设为0
pygame.mixer.music.set_volume(volume) #设置播放音乐的音量
if event.type==locals.MOUSEBUTTONDOWN: #判断事件类型是否为鼠标按下MOUSEBUTTONDOWN
click+=1 #记录点击鼠标的次数加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: #判断播放器没有正在播放音乐
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