forked from zhiyuan/Project1
修改音频文件为相对路径,移动文件到data目录,复用data目录获取函数
This commit is contained in:
1 parent
90f734158b
commit
805704f0e5
2 files changed
+5
-1
No files matched your search
File renamed without changes.
+5
-1
@@ -6,7 +6,10 @@
|
||||
# Datetime: 2026/7/25 下午10:44
|
||||
# Description:
|
||||
# ---------------------------------------------------------------------------
|
||||
import os
|
||||
|
||||
import pygame
|
||||
from src.config.game_config import data_path
|
||||
|
||||
# 初始化pygame
|
||||
pygame.init()
|
||||
@@ -22,7 +25,8 @@ screen = pygame.display.set_mode(size)
|
||||
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)
|
||||
|
||||
# 状态值
|
||||
|
||||
Reference in new issue
Block a user