Commit f8f2a1a6 by BellCodeEditor

auto save

parent 1cada82b
Showing with 5 additions and 3 deletions
import pygame import pygame
from pygame import locals from pygame import locals
vol=0.2 vol=0.2
c
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -26,9 +27,10 @@ while True: ...@@ -26,9 +27,10 @@ while True:
vol -= 0.1 vol -= 0.1
if vol<0: if vol<0:
vol=0 vol=0
#设置音量
if pygame.mixer.music.get_busy==False: pygame.mixer.music.set_volume(vol)
pygame.mixer.music.player() if pygame.mixer.music.get_busy()==False:
pygame.mixer.music.play()
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(stop_img, (270, 330)) # 暂停按钮 screen.blit(stop_img, (270, 330)) # 暂停按钮
......
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