修改音频文件为相对路径,移动文件到data目录,复用data目录获取函数

This commit is contained in:
chicrobot committed 2026-07-27 22:49:56 +08:00
1 parent 90f734158b
commit 805704f0e5
2 files changed
+5 -1

No files matched your search

+5 -1
View File
@@ -6,7 +6,10 @@
# Datetime: 2026/7/25 下午10:44 # Datetime: 2026/7/25 下午10:44
# Description: # Description:
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
import os
import pygame import pygame
from src.config.game_config import data_path
# 初始化pygame # 初始化pygame
pygame.init() pygame.init()
@@ -22,7 +25,8 @@ screen = pygame.display.set_mode(size)
pygame.display.set_caption("New_game") pygame.display.set_caption("New_game")
# 播放并循环音乐 # 播放并循环音乐
pygame.mixer_music.load(r'D:\python_project\Game_project\file\vespidaze-upbeat-rpg-battle-460971.mp3') data_path = data_path()
pygame.mixer_music.load(os.path.join(data_path, "vespidaze-upbeat-rpg-battle-460971.mp3"))
pygame.mixer_music.play(-1) pygame.mixer_music.play(-1)
# 状态值 # 状态值