Commit 61a1f449 by BellCodeEditor

save project

parent 130b0862
Showing with 22 additions and 11 deletions
......@@ -31,12 +31,12 @@ while True:
exit()
# 按键,控制声音大小
if event.type == locals.KEYDOWN:
if event.key == locals.K_w:
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_s:
if event.key == locals.K_DOWN:
volume -= 0.1
if volume < 0:
volume = 0
......@@ -45,6 +45,7 @@ while True:
if event.type == locals.MOUSEBUTTONDOWN:
if event.button == 1: # 左击
x, y = event.pos
# print(event.pos)
if x > 270 and x < 370 and y > 350 and y < 450: # 播放按钮
click += 1
if click % 2 == 0:
......@@ -53,23 +54,19 @@ while True:
else:
play_button = play_img
pygame.mixer.music.pause()
if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲
num += 1
if num > len(music_list) - 1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
if x > 420 and x < 520 and y > 350 and y < 450:
pygame.mixer.music.stop()
play_button = stop_img
if click % 2 == 0:
click += 2
else:
click += 1
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
if x > 120 and x < 220 and y > 350 and y < 450:
num -= 1
if num < 0:
num = len(music_list) - 1
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.load(path + music_list[num])
pygame.mixer.music.play()
play_button = stop_img
if click % 2 == 0:
......@@ -81,8 +78,22 @@ while True:
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.load(path+music_list[num])
pygame.mixer.music.play()
+++++++++++++++++++++++++++++++++++++
# 旋转图片(注意:这里要搞一个新变量,存储旋转后的图片)
new_logo = pygame.transform.rotate(logo_img, angle)
# 校正旋转图片的中心点
newRect = new_logo.get_rect(center=(320, 200))
# print(newRect) # rect(170, 65, 300, 270) 左上角坐标、图片大小
pos = (newRect[0], newRect[1])
angle += 1
+++++++++++++++++++++++++++++++++++++
# 绘制画面
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