Commit bbc0ec79 by BellCodeEditor

save project

parent 6d3cdec2
Showing with 13 additions and 2 deletions
...@@ -6,6 +6,9 @@ pygame.init() # 初始化 ...@@ -6,6 +6,9 @@ pygame.init() # 初始化
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
# 载入图片 # 载入图片
v=0.5 v=0.5
click=0
bg_img = pygame.image.load('background.png') # 背景图 bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮 play_img = pygame.image.load('play.png') # 播放按钮
stop_img = pygame.image.load('stop.png') # 暂停按钮 stop_img = pygame.image.load('stop.png') # 暂停按钮
...@@ -26,10 +29,18 @@ while True: ...@@ -26,10 +29,18 @@ while True:
v=v+0.1 v=v+0.1
if v>1: if v>1:
v=1 v=1
if event.type==locals.K_DOWN: if event.key==locals.K_DOWN:
v=v-0.1 v=v-0.1
if v<0: if v<0:
v=0 v=0
if event.type==locals.MOUSEBUTTONDOWN:
click+=1
if click%2==0:
play_button=stop_img
pygame.mixer.music.uppause()
else:
play_button=play_img
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