diff --git a/README.md b/README.md index 5ccc9ff..107cfbb 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,10 @@ nuitka --mingw --standalone --onefile --show-progress --show-memory --windows-di 加了背景音乐播放功能之后需要执行: ``` powershell -nuitka --mingw --standalone --onefile --show-progress --show-memory --windows-disable-console --output-dir=out --windows-icon-from-ico=pypvz.ico --include-data-dir=resources=resources --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libvorbisfile-3.dll=libvorbisfile-3.dll main.py +nuitka --mingw --standalone --onefile --show-progress --show-memory --output-dir=out --windows-icon-from-ico=pypvz.ico --include-data-dir=resources=resources --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libogg-0.dll=libogg-0.dll --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libopus-0.dll=libopus-0.dll --include-data-file=C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libopusfile-0.dll=libopusfile-0.dll --windows-disable-console main.py ``` -其中,`C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\libvorbisfile-3.dll`应当替换为`libvorbisfile-3.dll`实际所在路径 +其中,`C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\*.dll`应当替换为`*.dll`实际所在路径 可执行文件生成路径为`./out/main.exe` diff --git a/resources/music/battle.ogg b/resources/music/battle.ogg deleted file mode 100644 index 206d971..0000000 Binary files a/resources/music/battle.ogg and /dev/null differ diff --git a/resources/music/battle.opus b/resources/music/battle.opus new file mode 100644 index 0000000..d6e5d8d Binary files /dev/null and b/resources/music/battle.opus differ diff --git a/resources/music/bowling.ogg b/resources/music/bowling.ogg deleted file mode 100644 index 3061535..0000000 Binary files a/resources/music/bowling.ogg and /dev/null differ diff --git a/resources/music/bowling.opus b/resources/music/bowling.opus new file mode 100644 index 0000000..eba65f3 Binary files /dev/null and b/resources/music/bowling.opus differ diff --git a/resources/music/chooseYourSeeds.ogg b/resources/music/chooseYourSeeds.ogg deleted file mode 100644 index aac31c3..0000000 Binary files a/resources/music/chooseYourSeeds.ogg and /dev/null differ diff --git a/resources/music/chooseYourSeeds.opus b/resources/music/chooseYourSeeds.opus new file mode 100644 index 0000000..857bd24 Binary files /dev/null and b/resources/music/chooseYourSeeds.opus differ diff --git a/resources/music/dayLevel.ogg b/resources/music/dayLevel.ogg deleted file mode 100644 index 0c427aa..0000000 Binary files a/resources/music/dayLevel.ogg and /dev/null differ diff --git a/resources/music/dayLevel.opus b/resources/music/dayLevel.opus new file mode 100644 index 0000000..688cd77 Binary files /dev/null and b/resources/music/dayLevel.opus differ diff --git a/resources/music/intro.ogg b/resources/music/intro.ogg deleted file mode 100644 index ee0e7cb..0000000 Binary files a/resources/music/intro.ogg and /dev/null differ diff --git a/resources/music/intro.opus b/resources/music/intro.opus new file mode 100644 index 0000000..286a13c Binary files /dev/null and b/resources/music/intro.opus differ diff --git a/resources/music/nightLevel.ogg b/resources/music/nightLevel.ogg deleted file mode 100644 index 79d93c7..0000000 Binary files a/resources/music/nightLevel.ogg and /dev/null differ diff --git a/resources/music/nightLevel.opus b/resources/music/nightLevel.opus new file mode 100644 index 0000000..b3c1d4c Binary files /dev/null and b/resources/music/nightLevel.opus differ diff --git a/source/state/level.py b/source/state/level.py index 8c67231..14972f7 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -46,7 +46,7 @@ class Level(tool.State): self.done = True self.next = c.MAIN_MENU pg.mixer.music.stop() - pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.ogg")) + pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.opus")) pg.mixer.music.play(-1, 0) return if self.map_data[c.SHOVEL] == 0: @@ -58,14 +58,14 @@ class Level(tool.State): global bgm if mode == modeList[1]: # 冒险模式 if self.game_info[c.LEVEL_NUM] in {0, 1, 2}: # 白天关卡 - bgm = 'dayLevel.ogg' + bgm = 'dayLevel.opus' elif self.game_info[c.LEVEL_NUM] in {3}: # 夜晚关卡 - bgm = 'nightLevel.ogg' + bgm = 'nightLevel.opus' elif mode == modeList[0]: # 小游戏模式 if self.game_info[c.LEVEL_NUM] in {1}: # 传送带大战 - bgm = 'battle.ogg' + bgm = 'battle.opus' elif self.game_info[c.LEVEL_NUM] in {2}: # 坚果保龄球 - bgm = 'bowling.ogg' + bgm = 'bowling.opus' pg.mixer.music.stop() pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", bgm)) pg.mixer.music.play(-1, 0) @@ -295,7 +295,7 @@ class Level(tool.State): self.next = c.MAIN_MENU self.persist = {c.CURRENT_TIME:0.0, c.LEVEL_NUM:c.START_LEVEL_NUM} pg.mixer.music.stop() - pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.ogg")) + pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "intro.opus")) pg.mixer.music.play(-1, 0) return diff --git a/source/tool.py b/source/tool.py index 99a9869..a783d0b 100755 --- a/source/tool.py +++ b/source/tool.py @@ -208,5 +208,5 @@ PLANT_RECT = loadPlantImageRect() # 播放音乐 pg.mixer.init() -pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,"resources", "music", "intro.ogg")) +pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,"resources", "music", "intro.opus")) pg.mixer.music.play(-1, 0) \ No newline at end of file