You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.0 KiB
52 lines
1.0 KiB
6 months ago
|
import pygame
|
||
|
from tqdm import tqdm
|
||
|
import time
|
||
|
pygame.mixer.init()
|
||
|
# 修改音乐的 file 路径
|
||
|
|
||
|
# 循环播放音乐
|
||
|
file ='s.ogg'
|
||
|
track = pygame.mixer.music.load(file)
|
||
|
pygame.mixer.music.play()
|
||
|
# 初始化 PyGame
|
||
|
pygame.init()
|
||
|
|
||
|
# 设置屏幕大小
|
||
|
screen = pygame.display.set_mode((800, 600))
|
||
|
|
||
|
# 加载背景图片
|
||
|
background_image = pygame.image.load('1.webp')
|
||
|
|
||
|
# 进度条相关变量
|
||
|
progress = 0
|
||
|
max_progress = 100
|
||
|
progress_show = True
|
||
|
|
||
|
|
||
|
|
||
|
# 游戏循环
|
||
|
running = True
|
||
|
while running:
|
||
|
for event in pygame.event.get():
|
||
|
if event.type == pygame.QUIT:
|
||
|
running = False
|
||
|
|
||
|
# 绘制背景
|
||
|
screen.blit(background_image, (0, 0))
|
||
|
|
||
|
# 绘制进度条
|
||
|
pygame.draw.rect(screen, (0, 255, 0), (100, 400, progress * 6, 20))
|
||
|
# 更新进度
|
||
|
progress += 1
|
||
|
if progress > max_progress:
|
||
|
progress_show = False
|
||
|
screen.fill((255, 255, 255))
|
||
|
import cs.py
|
||
|
|
||
|
|
||
|
# 刷新屏幕
|
||
|
pygame.display.flip()
|
||
|
time.sleep(0.1)
|
||
|
|
||
|
# 退出 PyGame
|
||
|
pygame.quit()
|