diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 0492261..590a178 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: python_version: - - '3.10' + - "3.10" name: Windows Python ${{ matrix.python_version }} steps: - uses: actions/checkout@v2 @@ -37,7 +37,7 @@ jobs: # 使用pyinstaller构建 - name: Build pypvz with pyinstaller run: | - pyinstaller -F main.py ` + pyinstaller -F pypvz.py ` -n pypvz-with-python${{ matrix.python_version }}-pyinstaller-x64.exe ` --distpath ./out ` --noconsole ` @@ -45,6 +45,14 @@ jobs: --add-data="pypvz-exec-logo.png;./pypvz-exec-logo.png" ` -i ./pypvz.ico + - name: Release the version built by pyinstaller + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + tag: Current.Version.Built.with.Pyinstaller + artifacts: ./out/*pyinstaller*.exe + token: ${{ secrets.GITHUB_TOKEN }} + # 使用Nuitka构建 - name: Show nuitka version run: | @@ -66,24 +74,67 @@ jobs: --include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libvorbisfile-3.dll=libvorbisfile-3.dll ` --include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libvorbis-0.dll=libvorbis-0.dll ` --windows-disable-console ` - -o ./out/pypvz-with-python${{ matrix.python_version }}-nuitka-msvc-x64.exe ` - main.py + -o ./out/pypvz-with-python${{ matrix.python_version }}-nuitka-windows-x64.exe ` + pypvz.py # artifact压缩包处上传包含exe和运行环境的文件夹 - - name: "Upload binarie directory" + - name: "Upload binaries" uses: actions/upload-artifact@v2 with: - name: DIR-python-${{ matrix.python_version }} + name: artifact-windows-python-${{ matrix.python_version }} path: ./out/*.dist - - name: "Upload binaries of pyinstaller" - uses: actions/upload-artifact@v2 - with: - name: pyinstaller-python-${{ matrix.python_version }} - path: ./out/*pyinstaller*.exe - - name: "Upload binaries of pyinstaller" - uses: actions/upload-artifact@v2 - with: - name: nuitka-python-${{ matrix.python_version }} - path: ./out/*nuitka*.exe + #linux: + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # python_version: + # - "3.10" + # name: Ubuntu Python ${{ matrix.python_version }} + # steps: + # - name: 🛎️ Checkout + # uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + + # - name: 🐍 Use Python ${{ matrix.python_version }} + # uses: actions/setup-python@v2 + # with: + # python-version: ${{ matrix.python_version }} + + # - name: 🧳 Install dependencies + # run: | + # sudo apt-get update + # sudo apt-get install patchelf gdb ccache libfuse2 + # python -m pip install --no-python-version-warning --disable-pip-version-check zstandard appdirs ordered-set tqdm Jinja2 + # python -m pip install --no-python-version-warning --disable-pip-version-check nuitka + # python -m pip install --no-python-version-warning --disable-pip-version-check pygame + + # # 使用Nuitka构建 + # - name: Show nuitka version + # run: | + # env + # python -m nuitka --version + + # - name: Build pypvz with Nuitka + # run: | + # yes | python -m nuitka \ + # --show-progress \ + # --follow-imports \ + # --show-memory \ + # --output-dir=out \ + # --linux-onefile-icon=pypvz.ico \ + # -o ./out/pypvz \ + # --remove-output \ + # main.py + # cp -r ./resources ./out/resources + # cd out + # tar -cvpaf ../pypvz-with-python${{ matrix.python_version }}-nuitka-linux-x64.tar.zst . + + # - name: "Upload binaries" + # uses: actions/upload-artifact@v2 + # with: + # name: artifact-windows-python-${{ matrix.python_version }} + # path: ./pypvz-with-python${{ matrix.python_version }}-nuitka-linux-x64.tar.zst diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb5250f..db7777e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: python_version: - - '3.10' + - "3.10" name: Windows Python ${{ matrix.python_version }} steps: - uses: actions/checkout@v2 @@ -39,7 +39,7 @@ jobs: # 使用pyinstaller构建 - name: Build pypvz with pyinstaller run: | - pyinstaller -F main.py ` + pyinstaller -F pypvz.py ` -n pypvz-with-python${{ matrix.python_version }}-pyinstaller-x64.exe ` --distpath ./out ` --noconsole ` @@ -76,14 +76,14 @@ jobs: --include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libvorbisfile-3.dll=libvorbisfile-3.dll ` --include-data-file=c:\hostedtoolcache\windows\python\${{ matrix.python_version }}*\x64\lib\site-packages\pygame\libvorbis-0.dll=libvorbis-0.dll ` --windows-disable-console ` - -o ./out/pypvz-with-python${{ matrix.python_version }}-nuitka-msvc-x64.exe ` - main.py + -o ./out/pypvz-with-python${{ matrix.python_version }}-nuitka-windows-x64.exe ` + pypvz.py # artifact压缩包处上传包含exe和运行环境的文件夹 - name: "Upload binaries" uses: actions/upload-artifact@v2 with: - name: artifact-python-${{ matrix.python_version }} + name: artifact-windows-python-${{ matrix.python_version }} path: ./out/*.dist - name: Release the version built by nuitka @@ -93,3 +93,59 @@ jobs: tag: Latest artifacts: ./out/*nuitka*.exe token: ${{ secrets.GITHUB_TOKEN }} + + #linux: + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # python_version: + # - "3.10" + # name: Ubuntu Python ${{ matrix.python_version }} + # steps: + # - name: 🛎️ Checkout + # uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + + # - name: 🐍 Use Python ${{ matrix.python_version }} + # uses: actions/setup-python@v2 + # with: + # python-version: ${{ matrix.python_version }} + + # - name: 🧳 Install dependencies + # run: | + # sudo apt-get update + # sudo apt-get install patchelf gdb ccache libfuse2 zstd tar + # python -m pip install --no-python-version-warning --disable-pip-version-check zstandard appdirs ordered-set tqdm Jinja2 + # python -m pip install --no-python-version-warning --disable-pip-version-check nuitka + # python -m pip install --no-python-version-warning --disable-pip-version-check pygame + + # # 使用Nuitka构建 + # - name: Show nuitka version + # run: | + # env + # python -m nuitka --version + + # - name: Build pypvz with Nuitka + # run: | + # yes | python -m nuitka \ + # --show-progress \ + # --follow-imports \ + # --show-memory \ + # --output-dir=out \ + # --linux-onefile-icon=pypvz.ico \ + # -o ./out/pypvz \ + # --remove-output \ + # main.py + # cp -r ./resources ./out/resources + # cd out + # tar -cvpaf ../pypvz-with-python${{ matrix.python_version }}-nuitka-linux-x64.tar.zst . + + # - name: Release the version built by nuitka + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # tag: Latest + # artifacts: ./*.tar.zst + # token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 94d4374..07eadc6 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,57 @@ ## Python版植物大战僵尸 植物大战僵尸游戏的Python实现,基于[marblexu的项目进行创作](https://github.com/marblexu/PythonPlantsVsZombies),部分代码也整合自[callmebg的项目](https://github.com/callmebg/PythonPlantsVsZombies) - + **本项目为个人python语言学习的练习项目,仅供个人学习和研究使用,不得用于其他用途。如果这个游戏侵犯了版权,请联系我删除** -* 已有的植物:向日葵,豌豆射手,坚果墙,寒冰射手,樱桃炸弹,双发射手,三线射手,大嘴花,小喷菇,土豆雷,地刺,胆小菇,倭瓜,火爆辣椒,阳光菇,寒冰菇,魅惑菇,火炬树桩,睡莲,杨桃,咖啡豆,海蘑菇,高坚果,缠绕水草,毁灭菇,墓碑吞噬者,大喷菇,大蒜 +* 已有的植物:向日葵,豌豆射手,坚果墙,寒冰射手,樱桃炸弹,双发射手,三线射手,大嘴花,小喷菇,土豆雷,地刺,胆小菇,倭瓜,火爆辣椒,阳光菇,寒冰菇,魅惑菇,火炬树桩,睡莲,杨桃,咖啡豆,海蘑菇,高坚果,缠绕水草,毁灭菇,墓碑吞噬者,大喷菇,大蒜,南瓜头 * 已有的僵尸:普通僵尸,旗帜僵尸,路障僵尸,铁桶僵尸,读报僵尸,橄榄球僵尸,鸭子救生圈僵尸,铁门僵尸,撑杆跳僵尸,冰车僵尸,潜水僵尸 -* 使用 JSON 文件记录关卡信息数据 +* 使用JSON文件记录关卡信息数据 + * 在0.8.18.0及以后直接用python记录关卡的不可变数据,JSON目前仅用于用户存档 * 支持选择植物卡片 -* 支持白昼模式,夜晚模式,泳池模式,传送带模式和坚果保龄球模式 +* 支持白昼模式,夜晚模式,泳池模式,浓雾模式(暂时没有加入雾),传送带模式和坚果保龄球模式 * 支持背景音乐播放 + * 支持调节音量 * 支持音效 + * 支持与背景音乐一起调节音量 * 支持全屏模式 * 按`F`键进入全屏模式,按`U`键恢复至窗口模式 * 支持用小铲子移除植物 * 支持分波生成僵尸 * 支持“关卡进程”进度条显示 * 夜晚模式支持墓碑以及从墓碑生成僵尸 - * 含有泳池的模式也支持在最后一波时从泳池中自动冒出僵尸 +* 含有泳池的模式支持在最后一波时从泳池中自动冒出僵尸 * 支持保存进度 + * Windows下默认进度文件的保存路径为`~\AppData\Roaming\wszqkzqk.dev\pypvz\userdata.json` + * 其他操作系统为`~/.config/wszqkzqk.dev/pypvz/userdata.json` + * 存档为JSON文件,如果出现因存档损坏而造成程序无法启动,可以手动编辑修复或者删除该文件重试 + * 0.8.12.0版本后理论上不可能因为存档损坏而无法启动,如果有,请在[issues](https://github.com/wszqkzqk/pypvz/issues)中报告bug + * 仍然有可能因为升级后变量名不同而丢失存档的进度信息,这种情况手动编辑恢复即可 +* 支持错误日志记录 + * Windows下默认日志文件的保存路径为`~\AppData\Roaming\wszqkzqk.dev\pypvz\run.log` + * 其他操作系统为`~/.config/wszqkzqk.dev/pypvz/run.log` +* 支持自定义游戏速度倍率 + * 保存在游戏存档文件中,可以通过修改`game rate`值更改速度倍率 +* 游戏完成成就显示 + * 冒险模式全部完成显示银向日葵奖杯 + * 所有模式全部完成显示金向日葵奖杯 + * 光标移动到向日葵奖杯上是显示当前各个模式通关次数 ## 环境要求 -* `Python` >= 3.10,最好使用最新版 -* `Python-Pygame` >= 1.9,最好使用最新版 +* `Python3` (建议 >= 3.10,最好使用最新版) +* `Python-Pygame` (建议 >= 2.0,最好使用最新版) ## 开始游戏 ### 使用仓库源代码 -先克隆仓库内容,再运行`main.py`: +先克隆仓库内容,再运行`pypvz.py`: ```shell git clone https://github.com/wszqkzqk/pypvz.git cd pypvz -python main.py +python pypvz.py ``` ### 使用Windows可执行文件 @@ -60,28 +77,29 @@ python main.py ## 方法 * 使用鼠标收集阳光,种植植物 -* 你可以通过更改`source/constants.py`中的`START_LEVEL_NUM`的数值来更改冒险模式的起始关卡,更改`START_LITTLE_GAME_NUM`的数值来更改小游戏的起始关卡: +* 对于已经存在存档的用户,可以在`~\AppData\Roaming\wszqkzqk.dev\pypvz\userdata.json`(Windows)或`~/.config/wszqkzqk.dev/pypvz/userdata.json`(其他操作系统)中修改当前关卡: * 冒险模式: - * 1和2:白昼模式 - * 3:夜晚模式 - * 4和5:泳池模式 - * 6: 浓雾模式(暂时没有雾) + * 白昼模式——单行草皮:1 + * 白昼模式——三行草皮:2 + * 白昼模式:3~5 + * 夜晚模式:6~8 + * 泳池模式:9~11 + * 浓雾模式(暂时没有雾):12 * 小游戏模式: - * 1:坚果保龄球模式 - * 2:传送带模式(白天) - * 3:传送带模式(黑夜) - * 4:传送带模式(泳池) + * 坚果保龄球模式:1 + * 传送带模式(白天):2 + * 传送带模式(黑夜):3 + * 传送带模式(泳池):4 * 目前暂时按照以上设定,未与原版相符 -* 可以通过修改`source/constants.py`中的`GAME_RATE`来调节游戏速度倍率 -* **注意:目前单文件发布版本不支持自定义调整关卡和速度倍率** +* 可以通过修改存档JSON文件中的`game rate`值来调节游戏速度倍率 ## Windows单文件封装 ### 使用Nuitka进行构建 编译依赖: -- `Python` >= 3.10,最好使用最新版 -- `Python-Pygame` >= 1.9,最好使用最新版 +- `Python3` (建议 >= 3.10,最好使用最新版) +- `Python-Pygame` (建议 >= 2.0,最好使用最新版) - `Nuitka` - `MinGW-w64`(或其他C编译器) - `ccache` @@ -114,10 +132,10 @@ nuitka --mingw64 --standalone ` --lto=yes ` --windows-disable-console ` --windows-product-name=pypvz ` - --windows-company-name=null ` + --windows-company-name=wszqkzqk.dev ` --windows-file-description="pypvz" ` - --windows-product-version=0.6.9.0 ` - main.py + --windows-product-version=0.8.2.0 ` + pypvz.py ``` * 其中`C:\Users\17265\AppData\Local\Programs\Python\Python310\Lib\site-packages\pygame\xxx.dll`应当替换为`xxx.dll`实际所在路径,`--output-dir=`后应当跟实际需要输出的路径,绝对路径或者相对路径均可 @@ -125,7 +143,7 @@ nuitka --mingw64 --standalone ` * `--windows-product-version=`表示版本号信息,所跟内容格式必须为`x.x.x.x` * 建议开启`--lto=yes`选项优化链接,如果编译失败可以关闭此选项 -可执行文件生成路径为`./release/main.exe` +可执行文件生成路径为`./release/pypvz.exe` 如果只需要在本地生成编译文件测试,则只需要执行: @@ -136,19 +154,42 @@ nuitka --mingw64 ` --output-dir=test-build ` --windows-icon-from-ico=pypvz.ico ` --windows-product-name=pypvz ` - --windows-company-name=null ` + --windows-company-name=wszqkzqk.dev ` --windows-file-description=pypvz ` --windows-disable-console ` - --windows-product-version=0.7.33.0 ` - main.py + --windows-product-version=0.8.2.0 ` + pypvz.py ``` -这样生成的程序只能在有python环境的机器上运行 +这样生成的程序只能在具有相同python环境的机器上运行 ### 使用pyinstaller进行构建 +- 由于pyinstaller构建的程序运行效率显著较nuitka构建的程序低下,并且程序体积也往往比nuitka构建的程序大,因此本项目并不推荐使用pyinstaller构建 +- 但是因为pyinstaller直接封装了所导入的库中的全部内容,使用pyinstaller构建时不需要手动添加媒体解码库 +- pyinstaller并没有涉及python源代码优化、C源代码生成以及C源代码编译链接过程,因此编译速度显著快于nuitka + +编译依赖: +- `Python3` (建议 >= 3.10,最好使用最新版) +- `Python-Pygame` (建议 >= 2.0,最好使用最新版) +- `Pyinstaller` + +编译参考命令: +``` cmd +pyinstaller -F pypvz.py ` + --distpath ./release ` + --noconsole ` + --add-data="resources;./resources" ` + --add-data="pypvz-exec-logo.png;./pypvz-exec-logo.png" ` + -i ./pypvz.ico +``` + +可执行文件生成路径为`./release/pypvz.exe` + ### 使用Github Workflow进行自动构建 +直接复制本项目下的`.github/workflows`下的文件,进行少许改动即可满足大多数需求 + ## 已知bug 以下问题囿于个人目前的能力与精力,没有修复: @@ -156,6 +197,9 @@ nuitka --mingw64 ` * 这个想不到很好的实现方法,可能会想一种替代方案 * 魅惑的僵尸未用红色滤镜标识 * 这个可能会作为一种“特性” +* 南瓜头显示不正常 + * 对于部分“长得比较长”的植物甚至可以在南瓜头存在的情况下优先被啃食 +* 墓碑吞噬者吞噬墓碑过程中被吞噬的墓碑顶端不会消失 **欢迎提供[Pull requests](https://github.com/wszqkzqk/pypvz/pulls)或修复方法建议,也欢迎在这里反馈新的bug()** @@ -169,6 +213,7 @@ nuitka --mingw64 ` * `pg.mixer.music.set_volume()` * 可以用`音量+`、`音量-`按钮实现 * 注意字体颜色渲染 + * 该功能自0.8.14.0已实现 * 关卡开始前增加预览界面 * 增加解锁与选关功能 * 目前的设想与原版不同,在完成两轮冒险模式(初始冒险模式 + 戴夫选关的冒险模式)后可以自主选关~~(当然现在只是画饼)~~ @@ -241,6 +286,8 @@ nuitka --mingw64 ` * 增加部分音效 * 如爆炸、打击等 * 自0.6.9已部分实现 +* 增加关卡前的本关僵尸预览 +* 鼠标移动到植物上时显示部分信息,类似图鉴功能 ## 截屏 @@ -258,4 +305,18 @@ nuitka --mingw64 ` ![截屏12](/demo/demo12.webp) ![截屏13](/demo/demo13.webp) ![截屏14](/demo/demo14.webp) -![截屏15](/demo/demo15.webp) \ No newline at end of file +![截屏15](/demo/demo15.webp) +![截屏16](/demo/demo16.webp) +![截屏17](/demo/demo17.webp) +![截屏18](/demo/demo18.webp) +![截屏19](/demo/demo19.webp) +![截屏20](/demo/demo20.webp) +![截屏21](/demo/demo21.webp) + +## 关于日志与反馈 + +对于闪退情况,Linux用户与Windows下的python源代码运行用户可以直接在终端中复制出崩溃日志进行反馈。 + +Windows单文件封装版本无法通过终端显示日志,需要在日志文件中寻找崩溃原因 +* Windows默认日志文件路径为`~\AppData\Roaming\wszqkzqk.dev\pypvz\run.log` +* 其他操作系统为`~/.config/wszqkzqk.dev/pypvz/run.log`,但一般可以在终端中显示时用终端中的输出即可 diff --git a/demo/demo16.webp b/demo/demo16.webp new file mode 100644 index 0000000..e5acd5c Binary files /dev/null and b/demo/demo16.webp differ diff --git a/demo/demo17.webp b/demo/demo17.webp new file mode 100644 index 0000000..a0a5f36 Binary files /dev/null and b/demo/demo17.webp differ diff --git a/demo/demo18.webp b/demo/demo18.webp new file mode 100644 index 0000000..bb262bb Binary files /dev/null and b/demo/demo18.webp differ diff --git a/demo/demo19.webp b/demo/demo19.webp new file mode 100644 index 0000000..0ee8d42 Binary files /dev/null and b/demo/demo19.webp differ diff --git a/demo/demo20.webp b/demo/demo20.webp new file mode 100644 index 0000000..9221e89 Binary files /dev/null and b/demo/demo20.webp differ diff --git a/demo/demo21.webp b/demo/demo21.webp new file mode 100644 index 0000000..ceca465 Binary files /dev/null and b/demo/demo21.webp differ diff --git a/git-pull.sh b/git-pull.sh deleted file mode 100755 index 99171a8..0000000 --- a/git-pull.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cd `dirname $0`; pwd -git pull git@github.com:wszqkzqk/pypvz.git diff --git a/main.py b/main.py deleted file mode 100755 index 75571f0..0000000 --- a/main.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -import pygame as pg -from source import tool -from source import constants as c -from source.state import mainmenu, screen, level - -if __name__=='__main__': - # 控制状态机运行 - game = tool.Control() - state_dict = { c.MAIN_MENU: mainmenu.Menu(), - c.GAME_VICTORY: screen.GameVictoryScreen(), - c.GAME_LOSE: screen.GameLoseScreen(), - c.LEVEL: level.Level() - } - game.setup_states(state_dict, c.MAIN_MENU) - game.run() diff --git a/pypvz.py b/pypvz.py new file mode 100755 index 0000000..2d75121 --- /dev/null +++ b/pypvz.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +import logging +import traceback +import os +import pygame as pg +from logging.handlers import RotatingFileHandler +# 由于在后续本地模块中存在对pygame的调用,在此处必须完成pygame的初始化 +pg.init() + +from source import tool +from source import constants as c +from source.state import mainmenu, screen, level + +if __name__=="__main__": + # 日志设置 + if not os.path.exists(os.path.dirname(c.USERLOG_PATH)): + os.makedirs(os.path.dirname(c.USERLOG_PATH)) + logger = logging.getLogger("main") + formatter = logging.Formatter("%(asctime)s - %(levelname)s: %(message)s") + fileHandler = RotatingFileHandler(c.USERLOG_PATH, "a", 1024*1024, 0, "utf-8") + fileHandler.setFormatter(formatter) + streamHandler = logging.StreamHandler() + streamHandler.setFormatter(formatter) + logger.addHandler(fileHandler) + logger.addHandler(streamHandler) + + try: + # 控制状态机运行 + game = tool.Control() + state_dict = { c.MAIN_MENU: mainmenu.Menu(), + c.GAME_VICTORY: screen.GameVictoryScreen(), + c.GAME_LOSE: screen.GameLoseScreen(), + c.LEVEL: level.Level(), + c.AWARD_SCREEN: screen.AwardScreen(), + } + game.setup_states(state_dict, c.MAIN_MENU) + game.run() + except: + print() # 将日志输出与上文内容分隔开,增加可读性 + logger.error(f"\n{traceback.format_exc()}") diff --git a/resources/DroidSansFallback.ttf b/resources/DroidSansFallback.ttf new file mode 100644 index 0000000..cfbc66a Binary files /dev/null and b/resources/DroidSansFallback.ttf differ diff --git a/resources/data/entity/plant.json b/resources/data/entity/plant.json deleted file mode 100644 index a88c34f..0000000 --- a/resources/data/entity/plant.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "plant_image_rect":{ - "PeaNormal":{"x":28, "y":0, "width":28, "height":34}, - "PeaIce":{"x":26, "y":0, "width":30, "height":34}, - "Chomper":{"x":0, "y":0, "width":100, "height":114}, - "PuffShroom":{"x":0, "y":28, "width":35, "height":38}, - "PuffShroomSleep":{"x":1, "y":0, "width":39, "height":65}, - "BulletMushRoom":{"x":0, "y":1, "width":55, "height":21}, - "BulletSeaShroom":{"x":0, "y":1, "width":55, "height":21}, - "PotatoMine":{"x":0, "y":0, "width":75, "height":55}, - "Squash":{"x":10, "y":140, "width":80, "height":86}, - "SquashAim":{"x":10, "y":140, "width":80, "height":86}, - "Spikeweed":{"x":3, "y":0, "width":80, "height":35} - } -} \ No newline at end of file diff --git a/resources/data/entity/zombie.json b/resources/data/entity/zombie.json deleted file mode 100644 index fe26077..0000000 --- a/resources/data/entity/zombie.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "zombie_image_rect":{ - "Zombie":{"x":62, "width":90}, - "ZombieAttack":{"x":62, "width":90}, - "ZombieLostHead":{"x":62, "width":90}, - "ZombieLostHeadAttack":{"x":62, "width":90}, - "ZombieDie":{"x":0, "width":164}, - "BoomDie":{"x":68, "width":80}, - "ConeheadZombie":{"x":80, "width":80}, - "ConeheadZombieAttack":{"x":79, "width":87}, - "BucketheadZombie":{"x":54, "width":90}, - "BucketheadZombieAttack":{"x":46, "width":90}, - "FlagZombie":{"x":56, "width":110}, - "FlagZombieAttack":{"x":60, "width":100}, - "FlagZombieLostHead":{"x":55, "width":110}, - "FlagZombieLostHeadAttack":{"x":55, "width":110}, - "NewspaperZombie":{"x":48, "width":92}, - "NewspaperZombieAttack":{"x":48, "width":92}, - "NewspaperZombieNoPaper":{"x":40, "width":98}, - "NewspaperZombieNoPaperAttack":{"x":48, "width":92}, - "NewspaperZombieLostHead":{"x":44, "width":96}, - "NewspaperZombieLostHeadAttack":{"x":48, "width":92}, - "NewspaperZombieDie":{"x":0, "width":100}, - "DukyTubeZombie":{"x":55, "width":105}, - "DukyTubeZombieAttack":{"x":55, "width":105}, - "DukyTubeZombieDie":{"x":55, "width":105}, - "DukyTubeZombieLostHead":{"x":55, "width":105}, - "DukyTubeZombieSwim":{"x":55, "width":105}, - "ConeheadDukyTubeZombie":{"x":55, "width":105}, - "ConeheadDukyTubeZombieAttack":{"x":55, "width":105}, - "ConeheadDukyTubeZombieSwim":{"x":55, "width":105}, - "BucketheadDukyTubeZombie":{"x":55, "width":105}, - "BucketheadDukyTubeZombieAttack":{"x":55, "width":105}, - "BucketheadDukyTubeZombieSwim":{"x":55, "width":105}, - "ScreenDoorZombie":{"x":41, "width":100}, - "ScreenDoorZombieAttack":{"x":41, "width":100} - } -} \ No newline at end of file diff --git a/resources/data/map/level_0.json b/resources/data/map/level_0.json deleted file mode 100644 index 5dfd1e8..0000000 --- a/resources/data/map/level_0.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "background_type":2, - "init_sun_value":5000, - "shovel":1, - "spawn_zombies":"list", - "zombie_list":[ - {"time":0, "map_y":5, "name":"Zomboni"}, - {"time":1000, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":2000, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":3100, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":4500, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":5000, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":6000, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":7000, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":8000, "map_y":4, "name":"ScreenDoorZombie"}, - {"time":0, "map_y":1, "name":"NewspaperZombie"}, - {"time":0, "map_y":0, "name":"PoleVaultingZombie"}, - {"time":6000, "map_y":0, "name":"FootballZombie"}, - {"time":0, "map_y":3, "name":"ConeheadDuckyTubeZombie"}, - {"time":0, "map_y":2, "name":"SnorkelZombie"}, - {"time":90000, "map_y":2, "name":"ConeheadDuckyTubeZombie"} - ] -} diff --git a/resources/data/map/level_1.json b/resources/data/map/level_1.json deleted file mode 100644 index d2c13ec..0000000 --- a/resources/data/map/level_1.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "background_type": 0, - "init_sun_value": 50, - "shovel": 1, - "spawn_zombies":"auto", - "included_zombies":["Zombie"], - "num_flags":2 -} diff --git a/resources/data/map/level_2.json b/resources/data/map/level_2.json deleted file mode 100644 index f16411a..0000000 --- a/resources/data/map/level_2.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "background_type":0, - "init_sun_value":50, - "shovel":1, - "spawn_zombies":"auto", - "included_zombies":["Zombie", "ConeheadZombie", "PoleVaultingZombie"], - "num_flags":3 -} diff --git a/resources/data/map/level_3.json b/resources/data/map/level_3.json deleted file mode 100644 index ca3da02..0000000 --- a/resources/data/map/level_3.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "background_type":1, - "init_sun_value":50, - "shovel":1, - "spawn_zombies":"auto", - "included_zombies":["Zombie", "ConeheadZombie", "BucketheadZombie", "ScreenDoorZombie"], - "inevitable_zombie_list":{"20":["BucketheadZombie"]}, - "num_flags":3 -} diff --git a/resources/data/map/level_4.json b/resources/data/map/level_4.json deleted file mode 100644 index e044e90..0000000 --- a/resources/data/map/level_4.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "background_type":2, - "init_sun_value":50, - "shovel":1, - "spawn_zombies":"auto", - "included_zombies":["Zombie", "ConeheadZombie", "BucketheadZombie", "FootballZombie"], - "inevitable_zombie_list":{"20":["BucketheadZombie"], "30":["FootballZombie"]}, - "num_flags":4 -} diff --git a/resources/data/map/level_5.json b/resources/data/map/level_5.json deleted file mode 100644 index 54ee331..0000000 --- a/resources/data/map/level_5.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "background_type":2, - "init_sun_value":50, - "shovel":1, - "spawn_zombies":"auto", - "included_zombies":["Zombie", "Zomboni"], - "inevitable_zombie_list":{"30":["Zomboni"]}, - "num_flags":3 -} diff --git a/resources/data/map/level_6.json b/resources/data/map/level_6.json deleted file mode 100644 index 6e87a73..0000000 --- a/resources/data/map/level_6.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "background_type":3, - "init_sun_value":50, - "shovel":1, - "spawn_zombies":"auto", - "included_zombies":["Zombie", "ConeheadZombie", "BucketheadZombie", "FootballZombie"], - "inevitable_zombie_list":{"20":["BucketheadZombie"], "30":["FootballZombie"]}, - "num_flags":4 -} diff --git a/resources/data/map/littleGame_1.json b/resources/data/map/littleGame_1.json deleted file mode 100644 index 2a774a0..0000000 --- a/resources/data/map/littleGame_1.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "background_type":6, - "choosebar_type":2, - "shovel":0, - "spawn_zombies":"auto", - "included_zombies":["Zombie", "ConeheadZombie", "BucketheadZombie", "NewspaperZombie", "PoleVaultingZombie"], - "num_flags":4, - "inevitable_zombie_list":{"20":["BucketheadZombie"]}, - "card_pool":{ "WallNutBowling":300, - "RedWallNutBowling":100 - } -} diff --git a/resources/data/map/littleGame_2.json b/resources/data/map/littleGame_2.json deleted file mode 100644 index b672269..0000000 --- a/resources/data/map/littleGame_2.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "background_type":0, - "choosebar_type":1, - "shovel":1, - "spawn_zombies":"auto", - "num_flags":3, - "included_zombies":["Zombie", "ConeheadZombie", "BucketheadZombie", "PoleVaultingZombie"], - "inevitable_zombie_list":{"20":["BucketheadZombie"]}, - "card_pool":{ "Peashooter":200, - "SnowPea":200, - "WallNut":100, - "CherryBomb":100, - "RepeaterPea":200, - "Chomper":100, - "PotatoMine":100 - } -} diff --git a/resources/data/map/littleGame_3.json b/resources/data/map/littleGame_3.json deleted file mode 100644 index f12a22d..0000000 --- a/resources/data/map/littleGame_3.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "background_type":1, - "choosebar_type":1, - "shovel":1, - "spawn_zombies":"auto", - "num_flags":3, - "included_zombies":["Zombie", "ConeheadZombie", - "BucketheadZombie", "NewspaperZombie", - "FootballZombie", "ScreenDoorZombie"], - "inevitable_zombie_list":{"30":["FootballZombie"]}, - "card_pool":{ "PuffShroom":200, - "ScaredyShroom":100, - "IceShroom":100, - "HypnoShroom":100, - "DoomShroom":100, - "GraveBuster":100, - "FumeShroom":200 - } -} diff --git a/resources/data/map/littleGame_4.json b/resources/data/map/littleGame_4.json deleted file mode 100644 index 9c0ed0c..0000000 --- a/resources/data/map/littleGame_4.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "background_type":2, - "choosebar_type":1, - "shovel":1, - "spawn_zombies":"auto", - "num_flags":4, - "included_zombies":["Zombie", "ConeheadZombie", - "BucketheadZombie", "SnorkelZombie", - "Zomboni"], - "inevitable_zombie_list":{"30":["BucketheadZombie"]}, - "card_pool":{ "Lilypad":200, - "TorchWood":100, - "TallNut":100, - "TangleKlep":100, - "Spikeweed":100, - "Squash":100, - "Jalapeno":100, - "Threepeater":400 - } -} diff --git a/resources/freesansbold.ttf b/resources/freesansbold.ttf deleted file mode 100644 index a98562f..0000000 Binary files a/resources/freesansbold.ttf and /dev/null differ diff --git a/resources/graphics/Cards/card_cherrybomb.png b/resources/graphics/Cards/card_cherrybomb.png index 40274be..d8783d3 100644 Binary files a/resources/graphics/Cards/card_cherrybomb.png and b/resources/graphics/Cards/card_cherrybomb.png differ diff --git a/resources/graphics/Cards/card_cherrybomb_move.png b/resources/graphics/Cards/card_cherrybomb_move.png deleted file mode 100644 index d8783d3..0000000 Binary files a/resources/graphics/Cards/card_cherrybomb_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_chomper.png b/resources/graphics/Cards/card_chomper.png index e93c6c8..3ec32cd 100644 Binary files a/resources/graphics/Cards/card_chomper.png and b/resources/graphics/Cards/card_chomper.png differ diff --git a/resources/graphics/Cards/card_chomper_move.png b/resources/graphics/Cards/card_chomper_move.png deleted file mode 100644 index 3ec32cd..0000000 Binary files a/resources/graphics/Cards/card_chomper_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_coffeebean.png b/resources/graphics/Cards/card_coffeebean.png index 85f13f7..a78379f 100644 Binary files a/resources/graphics/Cards/card_coffeebean.png and b/resources/graphics/Cards/card_coffeebean.png differ diff --git a/resources/graphics/Cards/card_doomshroom.png b/resources/graphics/Cards/card_doomshroom.png index 2aa1e67..f14e167 100644 Binary files a/resources/graphics/Cards/card_doomshroom.png and b/resources/graphics/Cards/card_doomshroom.png differ diff --git a/resources/graphics/Cards/card_fumeshroom.png b/resources/graphics/Cards/card_fumeshroom.png index bdf1bf0..f48ecf6 100644 Binary files a/resources/graphics/Cards/card_fumeshroom.png and b/resources/graphics/Cards/card_fumeshroom.png differ diff --git a/resources/graphics/Cards/card_fumeshroom_move.png b/resources/graphics/Cards/card_fumeshroom_move.png deleted file mode 100644 index f48ecf6..0000000 Binary files a/resources/graphics/Cards/card_fumeshroom_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_garlic.png b/resources/graphics/Cards/card_garlic.png index 27e5520..98f728a 100644 Binary files a/resources/graphics/Cards/card_garlic.png and b/resources/graphics/Cards/card_garlic.png differ diff --git a/resources/graphics/Cards/card_gravebuster.png b/resources/graphics/Cards/card_gravebuster.png index e411f2b..80a5874 100644 Binary files a/resources/graphics/Cards/card_gravebuster.png and b/resources/graphics/Cards/card_gravebuster.png differ diff --git a/resources/graphics/Cards/card_gravebuster_move.png b/resources/graphics/Cards/card_gravebuster_move.png deleted file mode 100644 index 80a5874..0000000 Binary files a/resources/graphics/Cards/card_gravebuster_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_hypnoshroom.png b/resources/graphics/Cards/card_hypnoshroom.png index 3708c8b..e212860 100644 Binary files a/resources/graphics/Cards/card_hypnoshroom.png and b/resources/graphics/Cards/card_hypnoshroom.png differ diff --git a/resources/graphics/Cards/card_hypnoshroom_move.png b/resources/graphics/Cards/card_hypnoshroom_move.png deleted file mode 100644 index e212860..0000000 Binary files a/resources/graphics/Cards/card_hypnoshroom_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_iceshroom.png b/resources/graphics/Cards/card_iceshroom.png index 77dc16a..e0daf0b 100644 Binary files a/resources/graphics/Cards/card_iceshroom.png and b/resources/graphics/Cards/card_iceshroom.png differ diff --git a/resources/graphics/Cards/card_iceshroom_move.png b/resources/graphics/Cards/card_iceshroom_move.png deleted file mode 100644 index e0daf0b..0000000 Binary files a/resources/graphics/Cards/card_iceshroom_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_jalapeno.png b/resources/graphics/Cards/card_jalapeno.png index 042bbcd..e88b55a 100644 Binary files a/resources/graphics/Cards/card_jalapeno.png and b/resources/graphics/Cards/card_jalapeno.png differ diff --git a/resources/graphics/Cards/card_jalapeno_move.png b/resources/graphics/Cards/card_jalapeno_move.png deleted file mode 100644 index e88b55a..0000000 Binary files a/resources/graphics/Cards/card_jalapeno_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_lilypad.png b/resources/graphics/Cards/card_lilypad.png index beb77a8..ca33cf3 100644 Binary files a/resources/graphics/Cards/card_lilypad.png and b/resources/graphics/Cards/card_lilypad.png differ diff --git a/resources/graphics/Cards/card_lilypad_move.png b/resources/graphics/Cards/card_lilypad_move.png deleted file mode 100644 index ca33cf3..0000000 Binary files a/resources/graphics/Cards/card_lilypad_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_peashooter.png b/resources/graphics/Cards/card_peashooter.png index 2e20222..a86e850 100644 Binary files a/resources/graphics/Cards/card_peashooter.png and b/resources/graphics/Cards/card_peashooter.png differ diff --git a/resources/graphics/Cards/card_peashooter_move.png b/resources/graphics/Cards/card_peashooter_move.png deleted file mode 100644 index a86e850..0000000 Binary files a/resources/graphics/Cards/card_peashooter_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_potatomine.png b/resources/graphics/Cards/card_potatomine.png index f9abd76..315da5f 100644 Binary files a/resources/graphics/Cards/card_potatomine.png and b/resources/graphics/Cards/card_potatomine.png differ diff --git a/resources/graphics/Cards/card_potatomine_move.png b/resources/graphics/Cards/card_potatomine_move.png deleted file mode 100644 index 315da5f..0000000 Binary files a/resources/graphics/Cards/card_potatomine_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_puffshroom.png b/resources/graphics/Cards/card_puffshroom.png index ce37a42..3a25bad 100644 Binary files a/resources/graphics/Cards/card_puffshroom.png and b/resources/graphics/Cards/card_puffshroom.png differ diff --git a/resources/graphics/Cards/card_puffshroom_move.png b/resources/graphics/Cards/card_puffshroom_move.png deleted file mode 100644 index 3a25bad..0000000 Binary files a/resources/graphics/Cards/card_puffshroom_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_pumpkinhead.png b/resources/graphics/Cards/card_pumpkinhead.png new file mode 100644 index 0000000..a3be4f1 Binary files /dev/null and b/resources/graphics/Cards/card_pumpkinhead.png differ diff --git a/resources/graphics/Cards/card_redwallnut_move.png b/resources/graphics/Cards/card_redwallnut.png similarity index 100% rename from resources/graphics/Cards/card_redwallnut_move.png rename to resources/graphics/Cards/card_redwallnut.png diff --git a/resources/graphics/Cards/card_repeaterpea.png b/resources/graphics/Cards/card_repeaterpea.png index f47c24e..f9a0afc 100644 Binary files a/resources/graphics/Cards/card_repeaterpea.png and b/resources/graphics/Cards/card_repeaterpea.png differ diff --git a/resources/graphics/Cards/card_repeaterpea_move.png b/resources/graphics/Cards/card_repeaterpea_move.png deleted file mode 100644 index f9a0afc..0000000 Binary files a/resources/graphics/Cards/card_repeaterpea_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_scaredshroom_move.png b/resources/graphics/Cards/card_scaredshroom_move.png deleted file mode 100644 index 625254d..0000000 Binary files a/resources/graphics/Cards/card_scaredshroom_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_scaredyshroom.png b/resources/graphics/Cards/card_scaredyshroom.png index 54d44ac..625254d 100644 Binary files a/resources/graphics/Cards/card_scaredyshroom.png and b/resources/graphics/Cards/card_scaredyshroom.png differ diff --git a/resources/graphics/Cards/card_seashroom.png b/resources/graphics/Cards/card_seashroom.png index 506de74..ecd8bbe 100644 Binary files a/resources/graphics/Cards/card_seashroom.png and b/resources/graphics/Cards/card_seashroom.png differ diff --git a/resources/graphics/Cards/card_seashroom_move.png b/resources/graphics/Cards/card_seashroom_move.png deleted file mode 100644 index ecd8bbe..0000000 Binary files a/resources/graphics/Cards/card_seashroom_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_snowpea.png b/resources/graphics/Cards/card_snowpea.png index d1fc2fb..6df72ce 100644 Binary files a/resources/graphics/Cards/card_snowpea.png and b/resources/graphics/Cards/card_snowpea.png differ diff --git a/resources/graphics/Cards/card_snowpea_move.png b/resources/graphics/Cards/card_snowpea_move.png deleted file mode 100644 index 6df72ce..0000000 Binary files a/resources/graphics/Cards/card_snowpea_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_spikeweed.png b/resources/graphics/Cards/card_spikeweed.png index d661c6e..a4a70f8 100644 Binary files a/resources/graphics/Cards/card_spikeweed.png and b/resources/graphics/Cards/card_spikeweed.png differ diff --git a/resources/graphics/Cards/card_spikeweed_move.png b/resources/graphics/Cards/card_spikeweed_move.png deleted file mode 100644 index a4a70f8..0000000 Binary files a/resources/graphics/Cards/card_spikeweed_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_squash.png b/resources/graphics/Cards/card_squash.png index 0a5b406..fc667cb 100644 Binary files a/resources/graphics/Cards/card_squash.png and b/resources/graphics/Cards/card_squash.png differ diff --git a/resources/graphics/Cards/card_squash_move.png b/resources/graphics/Cards/card_squash_move.png deleted file mode 100644 index fc667cb..0000000 Binary files a/resources/graphics/Cards/card_squash_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_starfruit.png b/resources/graphics/Cards/card_starfruit.png index af7be92..45999fa 100644 Binary files a/resources/graphics/Cards/card_starfruit.png and b/resources/graphics/Cards/card_starfruit.png differ diff --git a/resources/graphics/Cards/card_starfruit_move.png b/resources/graphics/Cards/card_starfruit_move.png deleted file mode 100644 index 45999fa..0000000 Binary files a/resources/graphics/Cards/card_starfruit_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_sunflower.png b/resources/graphics/Cards/card_sunflower.png index 3413a28..e0ca28f 100644 Binary files a/resources/graphics/Cards/card_sunflower.png and b/resources/graphics/Cards/card_sunflower.png differ diff --git a/resources/graphics/Cards/card_sunshroom.png b/resources/graphics/Cards/card_sunshroom.png index 3f14fac..e2b6a45 100644 Binary files a/resources/graphics/Cards/card_sunshroom.png and b/resources/graphics/Cards/card_sunshroom.png differ diff --git a/resources/graphics/Cards/card_tallnut.png b/resources/graphics/Cards/card_tallnut.png index b91b4c2..67c2177 100644 Binary files a/resources/graphics/Cards/card_tallnut.png and b/resources/graphics/Cards/card_tallnut.png differ diff --git a/resources/graphics/Cards/card_tallnut_move.png b/resources/graphics/Cards/card_tallnut_move.png deleted file mode 100644 index 67c2177..0000000 Binary files a/resources/graphics/Cards/card_tallnut_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_tangleklep.png b/resources/graphics/Cards/card_tangleklep.png index d59175b..f7f208c 100644 Binary files a/resources/graphics/Cards/card_tangleklep.png and b/resources/graphics/Cards/card_tangleklep.png differ diff --git a/resources/graphics/Cards/card_tangleklep_move.png b/resources/graphics/Cards/card_tangleklep_move.png deleted file mode 100644 index f7f208c..0000000 Binary files a/resources/graphics/Cards/card_tangleklep_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_threepeashooter.png b/resources/graphics/Cards/card_threepeashooter.png index b7e5788..c46aab5 100644 Binary files a/resources/graphics/Cards/card_threepeashooter.png and b/resources/graphics/Cards/card_threepeashooter.png differ diff --git a/resources/graphics/Cards/card_threepeashooter_move.png b/resources/graphics/Cards/card_threepeashooter_move.png deleted file mode 100644 index c46aab5..0000000 Binary files a/resources/graphics/Cards/card_threepeashooter_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_torchwood.png b/resources/graphics/Cards/card_torchwood.png index 49318f1..b4fbb2c 100644 Binary files a/resources/graphics/Cards/card_torchwood.png and b/resources/graphics/Cards/card_torchwood.png differ diff --git a/resources/graphics/Cards/card_torchwood_move.png b/resources/graphics/Cards/card_torchwood_move.png deleted file mode 100644 index b4fbb2c..0000000 Binary files a/resources/graphics/Cards/card_torchwood_move.png and /dev/null differ diff --git a/resources/graphics/Cards/card_wallnut.png b/resources/graphics/Cards/card_wallnut.png index e7207f1..e56b255 100644 Binary files a/resources/graphics/Cards/card_wallnut.png and b/resources/graphics/Cards/card_wallnut.png differ diff --git a/resources/graphics/Cards/card_wallnut_move.png b/resources/graphics/Cards/card_wallnut_move.png deleted file mode 100644 index e56b255..0000000 Binary files a/resources/graphics/Cards/card_wallnut_move.png and /dev/null differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_0.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_0.png index 0a79f9b..1a7e552 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_0.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_0.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_1.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_1.png index e5a9a14..1f71353 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_1.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_1.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_10.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_10.png index a42062e..aa2b228 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_10.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_10.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_11.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_11.png index ac92a54..5a1646c 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_11.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_11.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_12.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_12.png index 776cc9e..ced6cbc 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_12.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_12.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_13.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_13.png index a4b0064..d33bd45 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_13.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_13.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_14.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_14.png index c86f012..ff3e7d1 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_14.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_14.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_2.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_2.png index 15db637..43856d5 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_2.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_2.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_3.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_3.png index 4d1a2f7..a1bada1 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_3.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_3.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_4.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_4.png index f42a16b..31b7c21 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_4.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_4.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_5.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_5.png index c267773..cdf553d 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_5.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_5.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_6.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_6.png index 2e66838..b027773 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_6.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_6.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_7.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_7.png index 50de883..fd12edb 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_7.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_7.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_8.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_8.png index 9d0dae8..7901d3d 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_8.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_8.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_9.png b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_9.png index a42062e..aa2b228 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_9.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroom/HypnoShroom_9.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_0.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_0.png index 1093170..be87dc0 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_0.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_0.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_1.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_1.png index af4dbdc..380d1a3 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_1.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_1.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_10.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_10.png index d54e2bd..0757701 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_10.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_10.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_11.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_11.png index 9d2809f..27ff5a6 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_11.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_11.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_12.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_12.png index cf87ac3..c22d153 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_12.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_12.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_2.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_2.png index 8ed7d4f..0124257 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_2.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_2.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_3.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_3.png index 3c8b3c7..68cadfc 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_3.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_3.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_4.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_4.png index d7a883a..a258a23 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_4.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_4.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_5.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_5.png index 465ae9b..e756127 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_5.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_5.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_6.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_6.png index dc46cbb..c777666 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_6.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_6.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_7.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_7.png index e490c34..285819b 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_7.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_7.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_8.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_8.png index ed304df..667a670 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_8.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_8.png differ diff --git a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_9.png b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_9.png index 5ef4994..ef0ad77 100644 Binary files a/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_9.png and b/resources/graphics/Plants/HypnoShroom/HypnoShroomSleep/HypnoShroomSleep_9.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_0.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_0.png index 1722a55..ad0fde0 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_0.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_0.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_1.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_1.png index 2fc5009..7b02790 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_1.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_1.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_10.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_10.png index 5e9d71c..680ce18 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_10.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_10.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_2.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_2.png index 98e4305..274597e 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_2.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_2.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_3.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_3.png index 37122a8..eba28a0 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_3.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_3.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_4.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_4.png index 42cb3e3..7c65139 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_4.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_4.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_5.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_5.png index 2155059..c714c25 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_5.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_5.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_6.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_6.png index 4369cac..ffa6fa6 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_6.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_6.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_7.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_7.png index b1d4508..57b22d2 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_7.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_7.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_8.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_8.png index b1d4508..57b22d2 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_8.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_8.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_9.png b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_9.png index 5e9d71c..680ce18 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_9.png and b/resources/graphics/Plants/IceShroom/IceShroom/IceShroom_9.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_0.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_0.png index 1b40432..3bab4cd 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_0.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_0.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_1.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_1.png index 04becb5..b99df3b 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_1.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_1.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_10.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_10.png index 278d076..62c930b 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_10.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_10.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_11.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_11.png index 85b76fc..1576751 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_11.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_11.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_2.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_2.png index 7c8d140..750af2c 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_2.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_2.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_3.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_3.png index c0411db..32d806b 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_3.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_3.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_4.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_4.png index 577e092..d4be262 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_4.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_4.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_5.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_5.png index 1af9abd..bb43c24 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_5.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_5.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_6.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_6.png index a205a00..9751bb3 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_6.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_6.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_7.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_7.png index 5cd8381..d9e9c8a 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_7.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_7.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_8.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_8.png index b774f40..594897e 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_8.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_8.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_9.png b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_9.png index 616f45c..79e9053 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_9.png and b/resources/graphics/Plants/IceShroom/IceShroomSleep/IceShroomSleep_9.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomSnow/IceShroomSnow_0.png b/resources/graphics/Plants/IceShroom/IceShroomSnow/IceShroomSnow_0.png index 1706ff1..de559c4 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomSnow/IceShroomSnow_0.png and b/resources/graphics/Plants/IceShroom/IceShroomSnow/IceShroomSnow_0.png differ diff --git a/resources/graphics/Plants/IceShroom/IceShroomTrap/IceShroomTrap_0.png b/resources/graphics/Plants/IceShroom/IceShroomTrap/IceShroomTrap_0.png index c7ccfa7..c858ebc 100644 Binary files a/resources/graphics/Plants/IceShroom/IceShroomTrap/IceShroomTrap_0.png and b/resources/graphics/Plants/IceShroom/IceShroomTrap/IceShroomTrap_0.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png index 1ca68e1..8fb9484 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_0.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png index 7d3ff8f..4bd5ea3 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_1.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png index 7bab3fd..32f47c6 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_2.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png index 1ec8d13..386f839 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_3.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png index 9da902b..19292ff 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_4.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png index 6569ebd..bf1587a 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_5.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png index 92825b9..a2d1518 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_6.png differ diff --git a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png index 1c97550..c101a51 100644 Binary files a/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png and b/resources/graphics/Plants/Jalapeno/Jalapeno/Jalapeno_7.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_0.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_0.png index 519f6aa..1705181 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_0.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_0.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_1.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_1.png index 31388a2..1b64d37 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_1.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_1.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_2.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_2.png index 6c94c57..cc42017 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_2.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_2.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_3.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_3.png index c34e9fd..c854dbf 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_3.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_3.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_4.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_4.png index 20d21af..414c891 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_4.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_4.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_5.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_5.png index 10308a3..be9a3b6 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_5.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_5.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_6.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_6.png index ee8a4eb..71a19d8 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_6.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_6.png differ diff --git a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_7.png b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_7.png index 45701ed..115a8e9 100644 Binary files a/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_7.png and b/resources/graphics/Plants/Jalapeno/JalapenoExplode/JalapenoExplode_7.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_0.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_0.png index 96efb6e..bb30816 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_0.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_0.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_1.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_1.png index b8c37ee..e9b862e 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_1.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_1.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_2.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_2.png index 9e741e3..4efa328 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_2.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_2.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_3.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_3.png index be35b0b..c142cf6 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_3.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_3.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_4.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_4.png index 23e4eff..7d50306 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_4.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_4.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_5.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_5.png index b8c37ee..e9b862e 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_5.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_5.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_6.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_6.png index 9e741e3..4efa328 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_6.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_6.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_7.png b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_7.png index be35b0b..c142cf6 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_7.png and b/resources/graphics/Plants/PotatoMine/PotatoMine/PotatoMine_7.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMineExplode/PotatoMineExplode_0.png b/resources/graphics/Plants/PotatoMine/PotatoMineExplode/PotatoMineExplode_0.png index f12ca5f..0943bfb 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMineExplode/PotatoMineExplode_0.png and b/resources/graphics/Plants/PotatoMine/PotatoMineExplode/PotatoMineExplode_0.png differ diff --git a/resources/graphics/Plants/PotatoMine/PotatoMineInit/PotatoMineInit_0.png b/resources/graphics/Plants/PotatoMine/PotatoMineInit/PotatoMineInit_0.png index 72c1fca..0500861 100644 Binary files a/resources/graphics/Plants/PotatoMine/PotatoMineInit/PotatoMineInit_0.png and b/resources/graphics/Plants/PotatoMine/PotatoMineInit/PotatoMineInit_0.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_0.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_0.png new file mode 100644 index 0000000..8876df8 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_0.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_1.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_1.png new file mode 100644 index 0000000..83c46f0 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_1.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_2.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_2.png new file mode 100644 index 0000000..c362447 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_2.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_3.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_3.png new file mode 100644 index 0000000..65ae2ec Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_3.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_4.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_4.png new file mode 100644 index 0000000..c123426 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_4.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_5.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_5.png new file mode 100644 index 0000000..00f1ddc Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_5.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_6.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_6.png new file mode 100644 index 0000000..f567de6 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_6.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_7.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_7.png new file mode 100644 index 0000000..09be209 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead/PumpkinHead_7.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead_cracked1/PumpkinHead_cracked1_0.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead_cracked1/PumpkinHead_cracked1_0.png new file mode 100644 index 0000000..7446ea8 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead_cracked1/PumpkinHead_cracked1_0.png differ diff --git a/resources/graphics/Plants/PumpkinHead/PumpkinHead_cracked2/PumpkinHead_cracked2_0.png b/resources/graphics/Plants/PumpkinHead/PumpkinHead_cracked2/PumpkinHead_cracked2_0.png new file mode 100644 index 0000000..9ee4d16 Binary files /dev/null and b/resources/graphics/Plants/PumpkinHead/PumpkinHead_cracked2/PumpkinHead_cracked2_0.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_0.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_0.png index ba733a3..e4010f4 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_0.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_0.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_1.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_1.png index 9e5d067..0158f3c 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_1.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_1.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_10.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_10.png index 291b293..769fd4d 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_10.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_10.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_11.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_11.png index 877af5a..95b0061 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_11.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_11.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_12.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_12.png index 26ca157..c9178ea 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_12.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_12.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_13.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_13.png index d575b3f..65efb37 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_13.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_13.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_14.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_14.png index fff8380..1ad5ea0 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_14.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_14.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_15.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_15.png index fff8380..1ad5ea0 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_15.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_15.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_16.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_16.png index dcc4818..2cadf1b 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_16.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_16.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_2.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_2.png index f6c0379..8567977 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_2.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_2.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_3.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_3.png index 49c0462..b95d8d0 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_3.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_3.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_4.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_4.png index 260ea2d..255422d 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_4.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_4.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_5.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_5.png index cb95661..bae2160 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_5.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_5.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_6.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_6.png index 4364821..2e1d0e2 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_6.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_6.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_7.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_7.png index 6844992..c6e5b68 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_7.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_7.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_8.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_8.png index 026a120..6d8c5bb 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_8.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_8.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_9.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_9.png index 1247365..a5b0a5d 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_9.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroom/ScaredyShroom_9.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_0.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_0.png index 01291fb..8743785 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_0.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_0.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_1.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_1.png index 74905bd..f9c4fa4 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_1.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_1.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_10.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_10.png index 010a1ec..e84ca5c 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_10.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_10.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_2.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_2.png index 6c95fa7..7315ffe 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_2.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_2.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_3.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_3.png index 5056db3..f274a9b 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_3.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_3.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_4.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_4.png index fe0a875..0840159 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_4.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_4.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_5.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_5.png index 7038061..e04b488 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_5.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_5.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_6.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_6.png index 9e82862..2d6c706 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_6.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_6.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_7.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_7.png index 7d48bac..cea8dfb 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_7.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_7.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_8.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_8.png index 9092794..db98ec7 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_8.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_8.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_9.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_9.png index 559ed0b..1c02348 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_9.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomCry/ScaredyShroomCry_9.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_0.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_0.png index 6e39890..990fdf5 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_0.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_0.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_1.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_1.png index ba8158c..9272c1f 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_1.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_1.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_10.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_10.png index 17b5e26..f8ccced 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_10.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_10.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_11.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_11.png index 7a0d8a7..d9df5b7 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_11.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_11.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_12.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_12.png index 4a22fa4..e42973a 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_12.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_12.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_13.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_13.png index 0dfe78c..3ca0684 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_13.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_13.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_14.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_14.png index 0dfe78c..3ca0684 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_14.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_14.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_15.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_15.png index a5fdf45..bf4ed6d 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_15.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_15.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_2.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_2.png index 3a58f4d..34badb2 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_2.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_2.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_3.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_3.png index b64c287..3f5ceb6 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_3.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_3.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_4.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_4.png index a694ff1..96d8a4d 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_4.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_4.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_5.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_5.png index 23faef2..c5a1638 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_5.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_5.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_6.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_6.png index 6d07b15..f63f3d8 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_6.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_6.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_7.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_7.png index ed7680b..26131fb 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_7.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_7.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_8.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_8.png index 88a3aac..65cea65 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_8.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_8.png differ diff --git a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_9.png b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_9.png index 17b5e26..f8ccced 100644 Binary files a/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_9.png and b/resources/graphics/Plants/ScaredyShroom/ScaredyShroomSleep/ScaredyShroomSleep_9.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_0.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_0.png index 5dcf98b..ae46f6c 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_0.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_0.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_1.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_1.png index 5dcf98b..ae46f6c 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_1.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_1.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_10.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_10.png index 6b4e404..e72bdbf 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_10.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_10.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_11.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_11.png index 4a0d0a2..0561278 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_11.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_11.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_12.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_12.png index 68af8f1..c9aa4b7 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_12.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_12.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_13.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_13.png index dcd5057..1f8ff6a 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_13.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_13.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_14.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_14.png index faa36dd..0a236d0 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_14.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_14.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_15.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_15.png index 09baa21..c90b4a6 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_15.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_15.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_16.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_16.png index abb3c8c..a4670ab 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_16.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_16.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_17.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_17.png index bc2817a..06386fa 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_17.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_17.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_18.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_18.png index 20e391d..b62425f 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_18.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_18.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_2.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_2.png index a2fa02e..1fced43 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_2.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_2.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_3.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_3.png index a2fa02e..1fced43 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_3.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_3.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_4.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_4.png index afbbf65..825d361 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_4.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_4.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_5.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_5.png index 88e5770..d8cf2a7 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_5.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_5.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_6.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_6.png index eed8160..8532839 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_6.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_6.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_7.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_7.png index acd491f..cbe86c6 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_7.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_7.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_8.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_8.png index acd491f..cbe86c6 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_8.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_8.png differ diff --git a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_9.png b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_9.png index 6b4e404..e72bdbf 100644 Binary files a/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_9.png and b/resources/graphics/Plants/Spikeweed/Spikeweed/Spikeweed_9.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_0.png b/resources/graphics/Plants/Squash/Squash/Squash_0.png index b6284ae..7a87696 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_0.png and b/resources/graphics/Plants/Squash/Squash/Squash_0.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_1.png b/resources/graphics/Plants/Squash/Squash/Squash_1.png index c5346a1..95c812d 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_1.png and b/resources/graphics/Plants/Squash/Squash/Squash_1.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_10.png b/resources/graphics/Plants/Squash/Squash/Squash_10.png index d3881dc..24f05bf 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_10.png and b/resources/graphics/Plants/Squash/Squash/Squash_10.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_11.png b/resources/graphics/Plants/Squash/Squash/Squash_11.png index e6d9103..0631a13 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_11.png and b/resources/graphics/Plants/Squash/Squash/Squash_11.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_12.png b/resources/graphics/Plants/Squash/Squash/Squash_12.png index 854f27f..4cf1e96 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_12.png and b/resources/graphics/Plants/Squash/Squash/Squash_12.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_13.png b/resources/graphics/Plants/Squash/Squash/Squash_13.png index 3abfc6c..32752ec 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_13.png and b/resources/graphics/Plants/Squash/Squash/Squash_13.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_14.png b/resources/graphics/Plants/Squash/Squash/Squash_14.png index ad3e95e..977a512 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_14.png and b/resources/graphics/Plants/Squash/Squash/Squash_14.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_15.png b/resources/graphics/Plants/Squash/Squash/Squash_15.png index 81327a6..1e6d289 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_15.png and b/resources/graphics/Plants/Squash/Squash/Squash_15.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_16.png b/resources/graphics/Plants/Squash/Squash/Squash_16.png index 85c87e0..cab0a36 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_16.png and b/resources/graphics/Plants/Squash/Squash/Squash_16.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_2.png b/resources/graphics/Plants/Squash/Squash/Squash_2.png index 99328cd..e4d9efd 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_2.png and b/resources/graphics/Plants/Squash/Squash/Squash_2.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_3.png b/resources/graphics/Plants/Squash/Squash/Squash_3.png index f797bc9..c2b01dc 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_3.png and b/resources/graphics/Plants/Squash/Squash/Squash_3.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_4.png b/resources/graphics/Plants/Squash/Squash/Squash_4.png index d2975c2..de3f3cd 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_4.png and b/resources/graphics/Plants/Squash/Squash/Squash_4.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_5.png b/resources/graphics/Plants/Squash/Squash/Squash_5.png index 6ffc0c3..e3877eb 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_5.png and b/resources/graphics/Plants/Squash/Squash/Squash_5.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_6.png b/resources/graphics/Plants/Squash/Squash/Squash_6.png index 818cc5f..db29438 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_6.png and b/resources/graphics/Plants/Squash/Squash/Squash_6.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_7.png b/resources/graphics/Plants/Squash/Squash/Squash_7.png index 3a19803..5fcaea5 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_7.png and b/resources/graphics/Plants/Squash/Squash/Squash_7.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_8.png b/resources/graphics/Plants/Squash/Squash/Squash_8.png index 8a0291f..8415a00 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_8.png and b/resources/graphics/Plants/Squash/Squash/Squash_8.png differ diff --git a/resources/graphics/Plants/Squash/Squash/Squash_9.png b/resources/graphics/Plants/Squash/Squash/Squash_9.png index 395cb96..8bbbbbd 100644 Binary files a/resources/graphics/Plants/Squash/Squash/Squash_9.png and b/resources/graphics/Plants/Squash/Squash/Squash_9.png differ diff --git a/resources/graphics/Plants/Squash/SquashAim/SquashAim_0.png b/resources/graphics/Plants/Squash/SquashAim/SquashAim_0.png index bf05208..69f9456 100644 Binary files a/resources/graphics/Plants/Squash/SquashAim/SquashAim_0.png and b/resources/graphics/Plants/Squash/SquashAim/SquashAim_0.png differ diff --git a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_0.png b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_0.png index 6997d2a..4b64fc1 100644 Binary files a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_0.png and b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_0.png differ diff --git a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_1.png b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_1.png index 31fe4c7..dc6e965 100644 Binary files a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_1.png and b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_1.png differ diff --git a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_2.png b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_2.png index 02bef9d..febc70c 100644 Binary files a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_2.png and b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_2.png differ diff --git a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_3.png b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_3.png index 41a93d8..e39e22d 100644 Binary files a/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_3.png and b/resources/graphics/Plants/Squash/SquashAttack/SquashAttack_3.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png index fe25d94..3474b1b 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_0.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png index 28fb904..549b8fd 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_1.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png index f6fbc61..c9a7932 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_2.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png index 0245c04..62589cd 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_3.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png index 28f49f7..fbc5079 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_4.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png index 4eaca99..78c26fe 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_5.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png index 818348b..ae41237 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_6.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png index 871bc62..b3739ed 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_7.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png index dfcea90..68b9d81 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_8.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png index be9ba3f..362580f 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png and b/resources/graphics/Plants/SunShroom/SunShroom/SunShroom_9.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_0.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_0.png index 77cd737..77155cd 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_0.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_0.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_1.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_1.png index 220a0e5..84b65ed 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_1.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_1.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_2.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_2.png index 0d57e91..1388803 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_2.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_2.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_3.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_3.png index 6fbb5e7..1a81c25 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_3.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_3.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_4.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_4.png index 948089a..667a82a 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_4.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_4.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_5.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_5.png index b7efcd1..61ff6ce 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_5.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_5.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_6.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_6.png index b98ef3b..02d195f 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_6.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_6.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_7.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_7.png index e103723..90a0b3c 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_7.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_7.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_8.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_8.png index 15acadc..264b439 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_8.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_8.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_9.png b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_9.png index 40e4e28..38b005d 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_9.png and b/resources/graphics/Plants/SunShroom/SunShroomBig/SunShroomBig_9.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_0.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_0.png index 1c0ac5c..50bc01c 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_0.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_0.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_1.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_1.png index 4de6109..d50c224 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_1.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_1.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_10.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_10.png index 30e3a41..1ca2c18 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_10.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_10.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_11.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_11.png index 955f934..db1463c 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_11.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_11.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_12.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_12.png index bff51d8..0903c26 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_12.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_12.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_13.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_13.png index 7b8f684..8c34f96 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_13.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_13.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_2.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_2.png index 00644b0..425f5d1 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_2.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_2.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_3.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_3.png index 99896d6..0dc61e0 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_3.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_3.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_4.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_4.png index 99896d6..0dc61e0 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_4.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_4.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_5.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_5.png index bbee2f5..bfeeaae 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_5.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_5.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_6.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_6.png index c7e8f73..ad44ea0 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_6.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_6.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_7.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_7.png index ccb7854..8f0a6ba 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_7.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_7.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_8.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_8.png index 70ab7e0..8d2e464 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_8.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_8.png differ diff --git a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_9.png b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_9.png index d07c079..70738a7 100644 Binary files a/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_9.png and b/resources/graphics/Plants/SunShroom/SunShroomSleep/SunShroomSleep_9.png differ diff --git a/resources/graphics/Plants/WallNut/RedWallNutBowling/RedWallNutBowling_0.png b/resources/graphics/Plants/WallNut/RedWallNutBowling/RedWallNutBowling_0.png index f9f5a27..387aa37 100644 Binary files a/resources/graphics/Plants/WallNut/RedWallNutBowling/RedWallNutBowling_0.png and b/resources/graphics/Plants/WallNut/RedWallNutBowling/RedWallNutBowling_0.png differ diff --git a/resources/graphics/Plants/WallNut/RedWallNutBowlingExplode/RedWallNutBowlingExplode_0.png b/resources/graphics/Plants/WallNut/RedWallNutBowlingExplode/RedWallNutBowlingExplode_0.png deleted file mode 100644 index 0286674..0000000 Binary files a/resources/graphics/Plants/WallNut/RedWallNutBowlingExplode/RedWallNutBowlingExplode_0.png and /dev/null differ diff --git a/resources/graphics/Plants/WallNut/WallNutBowling/WallNutBowling_0.png b/resources/graphics/Plants/WallNut/WallNutBowling/WallNutBowling_0.png index 673f40f..6524bbc 100644 Binary files a/resources/graphics/Plants/WallNut/WallNutBowling/WallNutBowling_0.png and b/resources/graphics/Plants/WallNut/WallNutBowling/WallNutBowling_0.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_0.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_0.png index 0f57fa2..061c521 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_0.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_0.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_1.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_1.png index 7783454..8af1128 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_1.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_1.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_10.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_10.png index 3aaecd7..494c9e6 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_10.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_10.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_11.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_11.png index ba221d8..eea3518 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_11.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_11.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_12.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_12.png index 902aad9..5972d71 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_12.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_12.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_13.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_13.png index 58a70aa..10a9b9e 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_13.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_13.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_14.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_14.png index acd1612..4a6fb1b 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_14.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_14.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_2.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_2.png index 32e7df6..3ef9ca2 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_2.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_2.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_3.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_3.png index 1462a5f..af1541f 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_3.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_3.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_4.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_4.png index 4aa08ce..1414be6 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_4.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_4.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_5.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_5.png index c56b855..042d336 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_5.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_5.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_6.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_6.png index 5ea8219..f6e026d 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_6.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_6.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_7.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_7.png index 6c5bd67..4615b79 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_7.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_7.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_8.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_8.png index d68d405..97adebc 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_8.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_8.png differ diff --git a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_9.png b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_9.png index cf18d79..91b0bd8 100644 Binary files a/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_9.png and b/resources/graphics/Plants/WallNut/WallNut_cracked2/WallNut_cracked2_9.png differ diff --git a/resources/graphics/Screen/AwardScreen.jpg b/resources/graphics/Screen/AwardScreen.jpg new file mode 100644 index 0000000..f275c9e Binary files /dev/null and b/resources/graphics/Screen/AwardScreen.jpg differ diff --git a/resources/graphics/Screen/GameLose.jpg b/resources/graphics/Screen/GameLose.jpg new file mode 100755 index 0000000..71a5975 Binary files /dev/null and b/resources/graphics/Screen/GameLose.jpg differ diff --git a/resources/graphics/Screen/GameLose.png b/resources/graphics/Screen/GameLose.png deleted file mode 100644 index cedfdd6..0000000 Binary files a/resources/graphics/Screen/GameLose.png and /dev/null differ diff --git a/resources/graphics/Screen/help_0.png b/resources/graphics/Screen/help_0.png new file mode 100755 index 0000000..ab4d069 Binary files /dev/null and b/resources/graphics/Screen/help_0.png differ diff --git a/resources/graphics/Screen/help_1.png b/resources/graphics/Screen/help_1.png new file mode 100755 index 0000000..958d2c4 Binary files /dev/null and b/resources/graphics/Screen/help_1.png differ diff --git a/resources/graphics/Screen/optionButton_0.png b/resources/graphics/Screen/optionButton_0.png new file mode 100755 index 0000000..479323b Binary files /dev/null and b/resources/graphics/Screen/optionButton_0.png differ diff --git a/resources/graphics/Screen/optionButton_1.png b/resources/graphics/Screen/optionButton_1.png new file mode 100755 index 0000000..b315da8 Binary files /dev/null and b/resources/graphics/Screen/optionButton_1.png differ diff --git a/resources/graphics/Screen/returnButton.png b/resources/graphics/Screen/returnButton.png deleted file mode 100644 index 28bcfe9..0000000 Binary files a/resources/graphics/Screen/returnButton.png and /dev/null differ diff --git a/resources/graphics/Screen/sunflowerTrophy.png b/resources/graphics/Screen/sunflowerTrophy.png new file mode 100644 index 0000000..1252270 Binary files /dev/null and b/resources/graphics/Screen/sunflowerTrophy.png differ diff --git a/resources/graphics/Screen/universalButton.png b/resources/graphics/Screen/universalButton.png new file mode 100644 index 0000000..66ff976 Binary files /dev/null and b/resources/graphics/Screen/universalButton.png differ diff --git a/resources/graphics/Screen/volumeButton.png b/resources/graphics/Screen/volumeButton.png new file mode 100644 index 0000000..c85ab70 Binary files /dev/null and b/resources/graphics/Screen/volumeButton.png differ diff --git a/resources/music/zenGarden.opus b/resources/music/zenGarden.opus new file mode 100644 index 0000000..754ab92 Binary files /dev/null and b/resources/music/zenGarden.opus differ diff --git a/resources/sound/cannotChooseWarning.ogg b/resources/sound/cannotChooseWarning.ogg new file mode 100644 index 0000000..8796aa9 Binary files /dev/null and b/resources/sound/cannotChooseWarning.ogg differ diff --git a/resources/sound/finalfanfare.ogg b/resources/sound/finalfanfare.ogg new file mode 100644 index 0000000..a600124 Binary files /dev/null and b/resources/sound/finalfanfare.ogg differ diff --git a/source/component/map.py b/source/component/map.py index 56d02de..19dfc40 100755 --- a/source/component/map.py +++ b/source/component/map.py @@ -1,8 +1,7 @@ import random -import pygame as pg -from .. import tool from .. import constants as c +# 记录植物种植情况的地图管理工具 class Map(): def __init__(self, background_type): self.background_type = background_type @@ -11,27 +10,27 @@ class Map(): self.width = c.GRID_POOL_X_LEN self.height = c.GRID_POOL_Y_LEN self.gridHeightSize = c.GRID_POOL_Y_SIZE - self.map = [[(c.INIT_MAP_GRID(c.MAP_GRASS), c.INIT_MAP_GRID(c.MAP_WATER))[y in {2, 3}] for x in range(self.width)] for y in range(self.height)] + self.map = [[(self.initMapGrid(c.MAP_GRASS), self.initMapGrid(c.MAP_WATER))[y in {2, 3}] for x in range(self.width)] for y in range(self.height)] elif self.background_type in c.ON_ROOF_BACKGROUNDS: self.width = c.GRID_ROOF_X_LEN self.height = c.GRID_ROOF_Y_LEN self.gridHeightSize = c.GRID_ROOF_Y_SIZE - self.map = [[c.INIT_MAP_GRID(c.MAP_TILE) for x in range(self.width)] for y in range(self.height)] + self.map = [[self.initMapGrid(c.MAP_TILE) for x in range(self.width)] for y in range(self.height)] elif self.background_type == c.BACKGROUND_SINGLE: self.width = c.GRID_X_LEN self.height = c.GRID_Y_LEN self.gridHeightSize = c.GRID_Y_SIZE - self.map = [[(c.INIT_MAP_GRID(c.MAP_UNAVAILABLE), c.INIT_MAP_GRID(c.MAP_GRASS))[y == 2] for x in range(self.width)] for y in range(self.height)] + self.map = [[(self.initMapGrid(c.MAP_UNAVAILABLE), self.initMapGrid(c.MAP_GRASS))[y == 2] for x in range(self.width)] for y in range(self.height)] elif self.background_type == c.BACKGROUND_TRIPLE: self.width = c.GRID_X_LEN self.height = c.GRID_Y_LEN self.gridHeightSize = c.GRID_Y_SIZE - self.map = [[(c.INIT_MAP_GRID(c.MAP_UNAVAILABLE), c.INIT_MAP_GRID(c.MAP_GRASS))[y in {1, 2, 3}] for x in range(self.width)] for y in range(self.height)] + self.map = [[(self.initMapGrid(c.MAP_UNAVAILABLE), self.initMapGrid(c.MAP_GRASS))[y in {1, 2, 3}] for x in range(self.width)] for y in range(self.height)] else: self.width = c.GRID_X_LEN self.height = c.GRID_Y_LEN self.gridHeightSize = c.GRID_Y_SIZE - self.map = [[c.INIT_MAP_GRID(c.MAP_GRASS) for x in range(self.width)] for y in range(self.height)] + self.map = [[self.initMapGrid(c.MAP_GRASS) for x in range(self.width)] for y in range(self.height)] def isValid(self, map_x, map_y): if (map_x < 0 or map_x >= self.width or @@ -39,6 +38,12 @@ class Map(): return False return True + # 地图单元格状态 + # 注意是可变对象,不能直接引用 + # 由于同一格显然不可能种两个相同的植物,所以用集合 + def initMapGrid(self, plot_type): + return {c.MAP_PLANT:set(), c.MAP_SLEEP:False, c.MAP_PLOT_TYPE:plot_type} + # 判断位置是否可用 # 暂时没有写紫卡植物的判断方法 # 由于紫卡植物需要移除以前的植物,所以可用另外定义一个函数 @@ -62,8 +67,10 @@ class Map(): if plantName not in c.WATER_PLANTS: if not self.map[map_y][map_x][c.MAP_PLANT]: # 没有植物肯定可以种植 return True - elif (all((i in {'花盆(未实现)', '南瓜头(未实现)'}) for i in self.map[map_y][map_x][c.MAP_PLANT]) - and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): # 例外植物:集合中填花盆和南瓜头,只要这里没有这种植物就能种植;判断方法:并集 + elif (all((i in {"花盆(未实现)", c.PUMPKINHEAD}) for i in self.map[map_y][map_x][c.MAP_PLANT]) + and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): # 例外植物:集合中填花盆和南瓜头,只要这里没有这种植物就能种植 + return True + elif (plantName == c.PUMPKINHEAD) and (c.PUMPKINHEAD not in self.map[map_y][map_x][c.MAP_PLANT]): # 没有南瓜头就能种南瓜头 return True else: return False @@ -72,14 +79,18 @@ class Map(): elif self.map[map_y][map_x][c.MAP_PLOT_TYPE] == c.MAP_TILE: # 屋顶 # 首先需要判断植物是否是水生植物,水生植物不能种植在陆地上 if plantName not in c.WATER_PLANTS: - if '花盆(未实现)' in self.map[map_y][map_x][c.MAP_PLANT]: - if (all((i in {'花盆(未实现)', '南瓜头(未实现)'}) for i in self.map[map_y][map_x][c.MAP_PLANT]) - and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): # 例外植物:集合中填花盆和南瓜头,只要这里没有这种植物就能种植;判断方法:并集 + if "花盆(未实现)" in self.map[map_y][map_x][c.MAP_PLANT]: + if (all((i in {"花盆(未实现)", c.PUMPKINHEAD}) for i in self.map[map_y][map_x][c.MAP_PLANT]) + and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): # 例外植物:集合中填花盆和南瓜头,只要这里没有这种植物就能种植 if plantName in {c.SPIKEWEED}: # 不能在花盆上种植的植物 return False else: return True - elif plantName == '花盆(未实现)': # 这一格本来没有花盆而且新来的植物是花盆,可以种 + elif (plantName == c.PUMPKINHEAD) and (c.PUMPKINHEAD not in self.map[map_y][map_x][c.MAP_PLANT]): # 有花盆且没有南瓜头就能种南瓜头 + return True + else: + return False + elif plantName == "花盆(未实现)": # 这一格本来没有花盆而且新来的植物是花盆,可以种 return True else: return False @@ -93,12 +104,14 @@ class Map(): return False else: # 非水生植物,依赖睡莲 if c.LILYPAD in self.map[map_y][map_x][c.MAP_PLANT]: - if (all((i in {c.LILYPAD, '南瓜头(未实现)'}) for i in self.map[map_y][map_x][c.MAP_PLANT]) + if (all((i in {c.LILYPAD, c.PUMPKINHEAD}) for i in self.map[map_y][map_x][c.MAP_PLANT]) and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): - if plantName in {c.SPIKEWEED, c.POTATOMINE, '花盆(未实现)'}: # 不能在睡莲上种植的植物 + if plantName in {c.SPIKEWEED, c.POTATOMINE, "花盆(未实现)"}: # 不能在睡莲上种植的植物 return False else: return True + elif (plantName == c.PUMPKINHEAD) and (c.PUMPKINHEAD not in self.map[map_y][map_x][c.MAP_PLANT]): # 在睡莲上且没有南瓜头就能种南瓜头 + return True else: return False else: @@ -157,3 +170,252 @@ class Map(): if self.isValid(map_x, map_y) and self.isAvailable(map_x, map_y, plantName): pos = self.getMapGridPos(map_x, map_y) return pos + + + +# 保存具体关卡地图信息常数 +# 冒险模式地图 +LEVEL_MAP_DATA = ( +# 第0关:测试模式地图 +{ + c.BACKGROUND_TYPE: 2, + c.INIT_SUN_NAME: 5000, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES: c.SPAWN_ZOMBIES_LIST, + c.ZOMBIE_LIST:[ + {"time":0, "map_y":5, "name":"Zomboni"}, + {"time":1000, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":2000, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":3100, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":4500, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":5000, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":6000, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":7000, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":8000, "map_y":4, "name":"ScreenDoorZombie"}, + {"time":0, "map_y":1, "name":"NewspaperZombie"}, + {"time":0, "map_y":0, "name":"PoleVaultingZombie"}, + {"time":6000, "map_y":0, "name":"FootballZombie"}, + {"time":0, "map_y":3, "name":"ConeheadDuckyTubeZombie"}, + {"time":0, "map_y":2, "name":"SnorkelZombie"}, + {"time":90000, "map_y":2, "name":"ConeheadDuckyTubeZombie"} + ] +}, +# 第1关:单行草皮 +{ + c.BACKGROUND_TYPE: 7, + c.INIT_SUN_NAME: 150, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES:(c.NORMAL_ZOMBIE,), + c.NUM_FLAGS:1 +}, +# 第2关:三行草皮 +{ + c.BACKGROUND_TYPE: 8, + c.INIT_SUN_NAME: 150, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES:(c.NORMAL_ZOMBIE,), + c.NUM_FLAGS:1 +}, +# 第3关 +{ + c.BACKGROUND_TYPE: 0, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES:(c.NORMAL_ZOMBIE,), + c.NUM_FLAGS:2 +}, +# 第4关 +{ + c.BACKGROUND_TYPE: 0, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: (c.NORMAL_ZOMBIE, c.CONEHEAD_ZOMBIE, c.POLE_VAULTING_ZOMBIE), + c.NUM_FLAGS:2 +}, +# 第5关 目前白天最后一关 +{ + c.BACKGROUND_TYPE: 0, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: (c.NORMAL_ZOMBIE, c.CONEHEAD_ZOMBIE, c.POLE_VAULTING_ZOMBIE, c.BUCKETHEAD_ZOMBIE), + c.NUM_FLAGS:3 +}, +# 第6关 目前夜晚第一关 +{ + c.BACKGROUND_TYPE: 1, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, + c.NEWSPAPER_ZOMBIE), + c.NUM_FLAGS:2 +}, +# 第7关 +{ + c.BACKGROUND_TYPE: 1, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, + c.SCREEN_DOOR_ZOMBIE,), + c.NUM_FLAGS: 2, + c.GRADE_GRAVES: 2, +}, +# 第8关 目前为夜晚最后一关 +{ + c.BACKGROUND_TYPE: 1, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.NEWSPAPER_ZOMBIE, + c.CONEHEAD_ZOMBIE, c.BUCKETHEAD_ZOMBIE, + c.SCREEN_DOOR_ZOMBIE, c.FOOTBALL_ZOMBIE), + c.INEVITABLE_ZOMBIE_DICT: { # 这里改用python实现了以后,键不再用字符串,改用数字 + # 仍然要注意字典值是元组 + 10: (c.NEWSPAPER_ZOMBIE,), + 20: (c.SCREEN_DOOR_ZOMBIE,), + 30: (c.FOOTBALL_ZOMBIE,), + }, + c.NUM_FLAGS: 3, + c.GRADE_GRAVES: 3, +}, +# 第9关 目前为泳池模式第一关 +{ + c.BACKGROUND_TYPE: 2, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.BUCKETHEAD_ZOMBIE, + c.CONEHEAD_ZOMBIE,), + c.NUM_FLAGS:2 +}, +# 第10关 +{ + c.BACKGROUND_TYPE: 2, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.BUCKETHEAD_ZOMBIE, + c.CONEHEAD_ZOMBIE, c.SNORKELZOMBIE), + c.INEVITABLE_ZOMBIE_DICT: {30: (c.SNORKELZOMBIE,)}, + c.NUM_FLAGS:3 +}, +# 第11关 +{ + c.BACKGROUND_TYPE: 2, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: (c.NORMAL_ZOMBIE, c.ZOMBONI), + c.INEVITABLE_ZOMBIE_DICT: {30: (c.ZOMBONI,)}, + c.NUM_FLAGS:3 +}, +# 第12关 目前为泳池最后一关 +{ + c.BACKGROUND_TYPE: 2, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.ZOMBONI, + c.BUCKETHEAD_ZOMBIE, + c.CONEHEAD_ZOMBIE, c.SNORKELZOMBIE), + c.INEVITABLE_ZOMBIE_DICT: {40: (c.ZOMBONI,)}, + c.NUM_FLAGS:4 +}, +# 第13关 目前为浓雾第一关 尚未完善 +{ + c.BACKGROUND_TYPE: 2, + c.INIT_SUN_NAME: 50, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.NEWSPAPER_ZOMBIE, + c.ZOMBONI, c.FOOTBALL_ZOMBIE, + c.CONEHEAD_ZOMBIE, c.BUCKETHEAD_HEALTH), + c.NUM_FLAGS:4 +}, +) + + + +# 玩玩小游戏地图 +LITTLE_GAME_MAP_DATA = ( +# 第0关 测试 目前空缺 +{}, +# 第1关 坚果保龄球 +{ + c.BACKGROUND_TYPE: 6, + c.CHOOSEBAR_TYPE: c.CHOOSEBAR_BOWLING, + c.SHOVEL: 0, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.CONEHEAD_ZOMBIE, + c.POLE_VAULTING_ZOMBIE, c.BUCKETHEAD_ZOMBIE, + c.NEWSPAPER_ZOMBIE), + c.NUM_FLAGS:3, + c.CARD_POOL: { c.WALLNUTBOWLING: 300, + c.REDWALLNUTBOWLING: 100,} +}, +# 第2关 白天 大决战 +{ + c.BACKGROUND_TYPE: 0, + c.CHOOSEBAR_TYPE: c.CHOOSEBAR_MOVE, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.CONEHEAD_ZOMBIE, + c.POLE_VAULTING_ZOMBIE, c.BUCKETHEAD_ZOMBIE,), + c.NUM_FLAGS:3, + c.CARD_POOL: { c.PEASHOOTER: 200, + c.SNOWPEASHOOTER: 100, + c.WALLNUT: 100, + c.CHERRYBOMB: 100, + c.REPEATERPEA: 200, + c.CHOMPER: 100, + c.POTATOMINE: 100,} +}, +# 第3关 夜晚 大决战 +{ + c.BACKGROUND_TYPE: 1, + c.CHOOSEBAR_TYPE: c.CHOOSEBAR_MOVE, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.CONEHEAD_ZOMBIE, + c.FOOTBALL_ZOMBIE, c.BUCKETHEAD_ZOMBIE, + c.NEWSPAPER_ZOMBIE, c.SCREEN_DOOR_ZOMBIE), + c.NUM_FLAGS:3, + c.CARD_POOL: { c.PUFFSHROOM: 100, + c.SCAREDYSHROOM: 100, + c.ICESHROOM: 100, + c.HYPNOSHROOM: 100, + c.DOOMSHROOM: 100, + c.GRAVEBUSTER: 100, + c.FUMESHROOM: 200}, + c.GRADE_GRAVES:3 +}, +# 第4关 泳池 大决战 +{ + c.BACKGROUND_TYPE: 2, + c.CHOOSEBAR_TYPE: c.CHOOSEBAR_MOVE, + c.SHOVEL: 1, + c.SPAWN_ZOMBIES:c.SPAWN_ZOMBIES_AUTO, + c.INCLUDED_ZOMBIES: ( c.NORMAL_ZOMBIE, c.CONEHEAD_ZOMBIE, + c.SNORKELZOMBIE, c.BUCKETHEAD_ZOMBIE, + c.ZOMBONI,), + c.NUM_FLAGS:4, + c.CARD_POOL: { c.LILYPAD: 300, + c.TORCHWOOD: 100, + c.TALLNUT: 100, + c.TANGLEKLEP: 100, + c.SPIKEWEED: 100, + c.SQUASH: 100, + c.JALAPENO: 50, + c.THREEPEASHOOTER: 400,} +}, +) + +# 总关卡数 +TOTAL_LEVEL = len(LEVEL_MAP_DATA) +TOTAL_LITTLE_GAME = len(LITTLE_GAME_MAP_DATA) diff --git a/source/component/menubar.py b/source/component/menubar.py index 187ab6b..1f1b4b6 100755 --- a/source/component/menubar.py +++ b/source/component/menubar.py @@ -1,6 +1,4 @@ -import os import random -from select import select import pygame as pg from .. import tool from .. import constants as c @@ -8,14 +6,14 @@ from .. import constants as c def getSunValueImage(sun_value): # for pack, must include ttf - fontPath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),'resources', 'freesansbold.ttf') - font = pg.font.Font(fontPath, 14) + font = pg.font.Font(c.FONT_PATH, 14) + font.bold = True width = 35 msg_image = font.render(str(sun_value), True, c.NAVYBLUE, c.LIGHTYELLOW) msg_rect = msg_image.get_rect() msg_w = msg_rect.width - image = pg.Surface([width, 17]) + image = pg.Surface((width, 17)) x = width - msg_w image.fill(c.LIGHTYELLOW) @@ -35,6 +33,12 @@ class Card(): self.rect = self.orig_image.get_rect() self.rect.x = x self.rect.y = y + # 绘制植物阳光消耗大小 + font = pg.font.Font(c.FONT_PATH, 12) + self.sun_cost_img = font.render(str(c.PLANT_CARD_INFO[index][c.SUN_INDEX]), True, c.BLACK) + self.sun_cost_img_rect = self.sun_cost_img.get_rect() + sun_cost_img_x = 32 - self.sun_cost_img_rect.w + self.orig_image.blit(self.sun_cost_img, (sun_cost_img_x, 52, self.sun_cost_img_rect.w, self.sun_cost_img_rect.h)) self.index = index self.sun_cost = c.PLANT_CARD_INFO[index][c.SUN_INDEX] @@ -161,6 +165,9 @@ class MenuBar(): if card.checkMouseClick(mouse_pos): if card.canClick(self.sun_value, self.current_time): result = (c.PLANT_CARD_INFO[card.index][c.PLANT_NAME_INDEX], card) + else: + # 播放无法使用该卡片的警告音 + c.SOUND_CANNOT_CHOOSE_WARNING.play() break return result @@ -189,7 +196,7 @@ class MenuBar(): self.value_image = getSunValueImage(self.sun_value) self.value_rect = self.value_image.get_rect() self.value_rect.x = 21 - self.value_rect.y = self.rect.bottom - 21 + self.value_rect.y = self.rect.bottom - 24 self.image.blit(self.value_image, self.value_rect) @@ -229,7 +236,7 @@ class Panel(): self.value_image = getSunValueImage(sun_value) self.value_rect = self.value_image.get_rect() self.value_rect.x = 21 - self.value_rect.y = self.menu_rect.bottom - 21 + self.value_rect.y = self.menu_rect.bottom - 24 self.button_image = self.loadFrame(c.START_BUTTON) self.button_rect = self.button_image.get_rect() @@ -260,7 +267,7 @@ class Panel(): self.selected_cards.remove(delete_card) self.selected_num -= 1 # 播放点击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "tap.ogg")).play() + c.SOUND_TAPPING_CARD.play() if self.selected_num >= c.CARD_MAX_NUM: return @@ -270,7 +277,7 @@ class Panel(): if card.canSelect(): self.addCard(card) # 播放点击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "tap.ogg")).play() + c.SOUND_TAPPING_CARD.play() break def addCard(self, card): @@ -398,7 +405,7 @@ class MoveBar(): x = self.card_end_x y = 6 selected_card = random.choices(self.card_pool_name, self.card_pool_weight)[0] - self.card_list.append(MoveCard(x, y, selected_card[c.CARD_INDEX] + "_move", selected_card[c.PLANT_NAME_INDEX])) + self.card_list.append(MoveCard(x, y, selected_card[c.CARD_INDEX], selected_card[c.PLANT_NAME_INDEX])) return True def update(self, current_time): diff --git a/source/component/plant.py b/source/component/plant.py index 33c0381..7275331 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -1,6 +1,5 @@ import random import pygame as pg -import os from .. import tool from .. import constants as c @@ -31,7 +30,7 @@ class Car(pg.sprite.Sprite): if self.state == c.IDLE: self.state = c.WALK # 播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "carWalking.ogg")).play() + c.SOUND_CAR_WALKING.play() def draw(self, surface): surface.blit(self.image, self.rect) @@ -65,9 +64,9 @@ class Bullet(pg.sprite.Sprite): def loadFrames(self, frames, name): frame_list = tool.GFX[name] - if name in tool.PLANT_RECT: - data = tool.PLANT_RECT[name] - x, y, width, height = data['x'], data['y'], data['width'], data['height'] + if name in c.PLANT_RECT: + data = c.PLANT_RECT[name] + x, y, width, height = data["x"], data["y"], data["width"], data["height"] else: x, y = 0, 0 rect = frame_list[0].get_rect() @@ -82,15 +81,15 @@ class Bullet(pg.sprite.Sprite): fly_name = self.name if self.name == c.BULLET_MUSHROOM: - explode_name = 'BulletMushRoomExplode' + explode_name = "BulletMushRoomExplode" elif self.name == c.BULLET_PEA_ICE: - explode_name = 'PeaIceExplode' + explode_name = "PeaIceExplode" elif self.name == c.BULLET_SEASHROOM: - explode_name = 'BulletSeaShroomExplode' + explode_name = "BulletSeaShroomExplode" elif self.name == c.BULLET_STAR: - explode_name = 'StarBulletExplode' + explode_name = "StarBulletExplode" else: - explode_name = 'PeaNormalExplode' + explode_name = "PeaNormalExplode" self.loadFrames(self.fly_frames, fly_name) self.loadFrames(self.explode_frames, explode_name) @@ -127,9 +126,9 @@ class Bullet(pg.sprite.Sprite): # 播放子弹爆炸音效 if self.name == c.BULLET_FIREBALL: - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "firepea.ogg")).play() + c.SOUND_FIREPEA_EXPLODE.play() else: - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "bulletExplode.ogg")).play() + c.SOUND_BULLET_EXPLODE.play() def draw(self, surface): surface.blit(self.image, self.rect) @@ -251,11 +250,11 @@ class Plant(pg.sprite.Sprite): # 被铲子指向时间 self.highlightTime = 0 - def loadFrames(self, frames, name, scale, color=c.BLACK): + def loadFrames(self, frames, name, scale=1, color=c.BLACK): frame_list = tool.GFX[name] - if name in tool.PLANT_RECT: - data = tool.PLANT_RECT[name] - x, y, width, height = data['x'], data['y'], data['width'], data['height'] + if name in c.PLANT_RECT: + data = c.PLANT_RECT[name] + x, y, width, height = data["x"], data["y"], data["width"], data["height"] else: x, y = 0, 0 rect = frame_list[0].get_rect() @@ -268,7 +267,7 @@ class Plant(pg.sprite.Sprite): self.loadFrames(self.frames, name, scale) def changeFrames(self, frames): - '''change image frames and modify rect position''' + """change image frames and modify rect position""" self.frames = frames self.frame_num = len(self.frames) self.frame_index = 0 @@ -417,7 +416,7 @@ class PeaShooter(Plant): c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=None)) self.shoot_timer = self.current_time # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shoot.ogg")).play() + c.SOUND_SHOOT.play() def setAttack(self): self.state = c.ATTACK @@ -441,13 +440,13 @@ class RepeaterPea(Plant): c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=None)) self.shoot_timer = self.current_time # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shoot.ogg")).play() + c.SOUND_SHOOT.play() elif self.firstShot and (self.current_time - self.shoot_timer) > 100: self.firstShot = False self.bullet_group.add(Bullet(self.rect.right - 15, self.rect.y, self.rect.y, c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=None)) # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shoot.ogg")).play() + c.SOUND_SHOOT.play() def setAttack(self): self.state = c.ATTACK @@ -483,7 +482,7 @@ class ThreePeaShooter(Plant): c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=None)) self.shoot_timer = self.current_time # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shoot.ogg")).play() + c.SOUND_SHOOT.play() def setAttack(self): self.state = c.ATTACK @@ -503,9 +502,9 @@ class SnowPeaShooter(Plant): c.BULLET_PEA_ICE, c.BULLET_DAMAGE_NORMAL, effect=c.BULLET_EFFECT_ICE)) self.shoot_timer = self.current_time # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shoot.ogg")).play() + c.SOUND_SHOOT.play() # 播放冰子弹音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "snowPeaSparkles.ogg")).play() + c.SOUND_SNOWPEA_SPARKLES.play() def setAttack(self): self.state = c.ATTACK @@ -523,11 +522,11 @@ class WallNut(Plant): self.cracked1_frames = [] self.cracked2_frames = [] - cracked1_frames_name = self.name + '_cracked1' - cracked2_frames_name = self.name + '_cracked2' + cracked1_frames_name = self.name + "_cracked1" + cracked2_frames_name = self.name + "_cracked2" - self.loadFrames(self.cracked1_frames, cracked1_frames_name, 1) - self.loadFrames(self.cracked2_frames, cracked2_frames_name, 1) + self.loadFrames(self.cracked1_frames, cracked1_frames_name) + self.loadFrames(self.cracked2_frames, cracked2_frames_name) def idling(self): if (not self.cracked1) and self.health <= c.WALLNUT_CRACKED1_HEALTH: @@ -549,7 +548,7 @@ class CherryBomb(Plant): self.explode_x_range = c.GRID_X_SIZE * 1.5 def setBoom(self): - frame = tool.GFX[c.CHERRY_BOOM_IMAGE] + frame = tool.GFX[c.BOOM_IMAGE] rect = frame.get_rect() width, height = rect.w, rect.h @@ -567,7 +566,7 @@ class CherryBomb(Plant): if self.bomb_timer == 0: self.bomb_timer = self.current_time # 播放爆炸音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "bomb.ogg")).play() + c.SOUND_BOMB.play() elif (self.current_time - self.bomb_timer) > 500: self.health = 0 else: @@ -606,13 +605,13 @@ class Chomper(Plant): self.animate_interval = 100 # 本身动画播放较慢 idle_name = name - attack_name = name + 'Attack' - digest_name = name + 'Digest' + attack_name = name + "Attack" + digest_name = name + "Digest" frame_list = [self.idle_frames, self.attack_frames, self.digest_frames] name_list = [idle_name, attack_name, digest_name] scale_list = [1, 1, 1] - rect_list = [(0, 0, 100, 114), None, None] + #rect_list = [(0, 0, 100, 114), None, None] for i, name in enumerate(name_list): self.loadFrames(frame_list[i], name, scale_list[i]) @@ -647,7 +646,7 @@ class Chomper(Plant): def attacking(self): if self.frame_index == (self.frame_num - 3): # 播放吞的音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "bigchomp.ogg")).play() + c.SOUND_BIGCHOMP.play() if self.attack_zombie.alive(): self.shouldDiggest = True self.attack_zombie.kill() @@ -677,13 +676,13 @@ class PuffShroom(Plant): self.sleep_frames = [] idle_name = name - sleep_name = name + 'Sleep' + sleep_name = name + "Sleep" frame_list = [self.idle_frames, self.sleep_frames] name_list = [idle_name, sleep_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -695,7 +694,7 @@ class PuffShroom(Plant): c.BULLET_MUSHROOM, c.BULLET_DAMAGE_NORMAL, effect=None)) self.shoot_timer = self.current_time # 播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "puff.ogg")).play() + c.SOUND_PUFF.play() def canAttack(self, zombie): if (zombie.name == c.SNORKELZOMBIE) and (zombie.frames == zombie.swim_frames): @@ -727,15 +726,15 @@ class PotatoMine(Plant): self.idle_frames = [] self.explode_frames = [] - init_name = name + 'Init' + init_name = name + "Init" idle_name = name - explode_name = name + 'Explode' + explode_name = name + "Explode" frame_list = [self.init_frames, self.idle_frames, self.explode_frames] name_list = [init_name, idle_name, explode_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1, c.WHITE) + self.loadFrames(frame_list[i], name) self.frames = self.init_frames @@ -760,7 +759,7 @@ class PotatoMine(Plant): if self.bomb_timer == 0: self.bomb_timer = self.current_time # 播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "potatomine.ogg")).play() + c.SOUND_POTATOMINE.play() self.changeFrames(self.explode_frames) self.start_boom = True elif (self.current_time - self.bomb_timer) > 500: @@ -781,14 +780,14 @@ class Squash(Plant): self.attack_frames = [] idle_name = name - aim_name = name + 'Aim' - attack_name = name + 'Attack' + aim_name = name + "Aim" + attack_name = name + "Attack" frame_list = [self.idle_frames, self.aim_frames, self.attack_frames] name_list = [idle_name, aim_name, attack_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1, c.WHITE) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -820,10 +819,10 @@ class Squash(Plant): self.mapPlantsSet.remove(c.SQUASH) self.kill() # 播放碾压音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "squashing.ogg")).play() + c.SOUND_SQUASHING.play() elif self.aim_timer == 0: # 锁定目标时播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "squashHmm.ogg")).play() + c.SOUND_SQUASH_HMM.play() self.aim_timer = self.current_time self.changeFrames(self.aim_frames) elif (self.current_time - self.aim_timer) > 1000: @@ -838,13 +837,10 @@ class Squash(Plant): class Spikeweed(Plant): def __init__(self, x, y): - Plant.__init__(self, x, y, c.SPIKEWEED, c.PLANT_HEALTH, None) + Plant.__init__(self, x, y, c.SPIKEWEED, c.PLANT_HEALTH, None, scale=0.9) self.animate_interval = 70 self.attack_timer = 0 - def loadImages(self, name, scale): - self.loadFrames(self.frames, name, 0.9, c.WHITE) - def setIdle(self): self.animate_interval = 70 self.state = c.IDLE @@ -852,7 +848,7 @@ class Spikeweed(Plant): def canAttack(self, zombie): # 地刺能不能扎的判据:僵尸中心与地刺中心的距离或僵尸包括了地刺中心和右端(平衡得到合理的攻击范围,"僵尸包括了地刺中心和右端"是为以后巨人做准备) # 暂时不能用碰撞判断,平衡性不好 - if ((-45 <= zombie.rect.x - self.rect.x <= 30) or (zombie.rect.left <= self.rect.x <= zombie.rect.right and zombie.rect.left <= self.rect.right <= zombie.rect.right)): + if ((-40 <= zombie.rect.centerx - self.rect.centerx <= 40) or (zombie.rect.left <= self.rect.x <= zombie.rect.right and zombie.rect.left <= self.rect.right <= zombie.rect.right)): return True return False @@ -881,7 +877,7 @@ class Spikeweed(Plant): if killSelf: self.health = 0 # 播放攻击音效,同子弹打击 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "bulletExplode.ogg")).play() + c.SOUND_BULLET_EXPLODE.play() class Jalapeno(Plant): @@ -896,10 +892,10 @@ class Jalapeno(Plant): def loadImages(self, name, scale): self.explode_frames = [] - explode_name = name + 'Explode' - self.loadFrames(self.explode_frames, explode_name, 1, c.WHITE) + explode_name = name + "Explode" + self.loadFrames(self.explode_frames, explode_name) - self.loadFrames(self.frames, name, 1, c.WHITE) + self.loadFrames(self.frames, name) def setExplode(self): self.changeFrames(self.explode_frames) @@ -912,7 +908,7 @@ class Jalapeno(Plant): if (self.current_time - self.animate_timer) > 100: if self.frame_index == 1: # 播放爆炸音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "bomb.ogg")).play() + c.SOUND_BOMB.play() self.frame_index += 1 if self.frame_index >= self.frame_num: self.health = 0 @@ -952,14 +948,14 @@ class ScaredyShroom(Plant): self.sleep_frames = [] idle_name = name - cry_name = name + 'Cry' - sleep_name = name + 'Sleep' + cry_name = name + "Cry" + sleep_name = name + "Sleep" frame_list = [self.idle_frames, self.cry_frames, self.sleep_frames] name_list = [idle_name, cry_name, sleep_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1, c.WHITE) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -990,7 +986,7 @@ class ScaredyShroom(Plant): c.BULLET_MUSHROOM, c.BULLET_DAMAGE_NORMAL, effect=None)) self.shoot_timer = self.current_time # 播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "puff.ogg")).play() + c.SOUND_PUFF.play() class SunShroom(Plant): @@ -1009,14 +1005,14 @@ class SunShroom(Plant): self.sleep_frames = [] idle_name = name - big_name = name + 'Big' - sleep_name = name + 'Sleep' + big_name = name + "Big" + sleep_name = name + "Sleep" frame_list = [self.idle_frames, self.big_frames, self.sleep_frames] name_list = [idle_name, big_name, sleep_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1, c.WHITE) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -1028,7 +1024,7 @@ class SunShroom(Plant): self.changeFrames(self.big_frames) self.is_big = True # 播放长大音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "plantGrow.ogg")).play() + c.SOUND_PLANT_GROW.play() if self.sun_timer == 0: self.sun_timer = self.current_time - (c.FLOWER_SUN_INTERVAL - 6000) elif (self.current_time - self.sun_timer) > c.FLOWER_SUN_INTERVAL: @@ -1052,16 +1048,16 @@ class IceShroom(Plant): self.trap_frames = [] idle_name = name - snow_name = name + 'Snow' - sleep_name = name + 'Sleep' - trap_name = name + 'Trap' + snow_name = name + "Snow" + sleep_name = name + "Sleep" + trap_name = name + "Trap" frame_list = [self.idle_frames, self.snow_frames, self.sleep_frames, self.trap_frames] name_list = [idle_name, snow_name, sleep_name, trap_name] scale_list = [1, 1.5, 1, 1] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, scale_list[i], c.WHITE) + self.loadFrames(frame_list[i], name, scale_list[i]) self.frames = self.idle_frames @@ -1118,13 +1114,13 @@ class HypnoShroom(Plant): self.sleep_frames = [] idle_name = name - sleep_name = name + 'Sleep' + sleep_name = name + "Sleep" frame_list = [self.idle_frames, self.sleep_frames] name_list = [idle_name, sleep_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1, c.WHITE) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -1148,7 +1144,7 @@ class WallNutBowling(Plant): self.disable_hit_y = -1 def loadImages(self, name, scale): - self.loadFrames(self.frames, name, 1, c.WHITE) + self.loadFrames(self.frames, name, 1) def idling(self): if self.move_timer == 0: @@ -1233,16 +1229,12 @@ class RedWallNutBowling(Plant): def loadImages(self, name, scale): self.idle_frames = [] - self.explode_frames = [] + self.loadFrames(self.idle_frames, name, 1) - idle_name = name - explode_name = name + 'Explode' - - frame_list = [self.idle_frames, self.explode_frames] - name_list = [idle_name, explode_name] - - for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1, c.WHITE) + frame = tool.GFX[c.BOOM_IMAGE] + rect = frame.get_rect() + image = tool.get_image(frame, 0, 0, rect.w, rect.h) + self.explode_frames = (image, ) self.frames = self.idle_frames @@ -1262,7 +1254,7 @@ class RedWallNutBowling(Plant): self.explode_timer = self.current_time self.changeFrames(self.explode_frames) # 播放爆炸音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "bomb.ogg")).play() + c.SOUND_BOMB.play() elif (self.current_time - self.explode_timer) > 500: self.health = 0 @@ -1347,7 +1339,7 @@ class StarFruit(Plant): self.bullet_group.add(StarBullet(self.rect.right - 5, self.rect.y - 10, c.BULLET_DAMAGE_NORMAL, c.STAR_FORWARD_UP, self.level)) self.shoot_timer = self.current_time # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shoot.ogg")).play() + c.SOUND_SHOOT.play() def setAttack(self): self.state = c.ATTACK @@ -1378,7 +1370,7 @@ class CoffeeBean(Plant): plant.setIdle() plant.changeFrames(plant.idle_frames) # 播放唤醒音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "mushroomWakeup.ogg")).play() + c.SOUND_MUSHROOM_WAKEUP.play() self.mapContent[c.MAP_PLANT].remove(self.name) self.kill() self.frame_index = self.frame_num - 1 @@ -1406,13 +1398,13 @@ class SeaShroom(Plant): self.sleep_frames = [] idle_name = name - sleep_name = name + 'Sleep' + sleep_name = name + "Sleep" frame_list = [self.idle_frames, self.sleep_frames] name_list = [idle_name, sleep_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -1424,7 +1416,7 @@ class SeaShroom(Plant): c.BULLET_SEASHROOM, c.BULLET_DAMAGE_NORMAL, effect=None)) self.shoot_timer = self.current_time # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "puff.ogg")).play() + c.SOUND_PUFF.play() def canAttack(self, zombie): if (zombie.name == c.SNORKELZOMBIE) and (zombie.frames == zombie.swim_frames): @@ -1451,11 +1443,11 @@ class TallNut(Plant): self.cracked1_frames = [] self.cracked2_frames = [] - cracked1_frames_name = self.name + '_cracked1' - cracked2_frames_name = self.name + '_cracked2' + cracked1_frames_name = self.name + "_cracked1" + cracked2_frames_name = self.name + "_cracked2" - self.loadFrames(self.cracked1_frames, cracked1_frames_name, 1) - self.loadFrames(self.cracked2_frames, cracked2_frames_name, 1) + self.loadFrames(self.cracked1_frames, cracked1_frames_name) + self.loadFrames(self.cracked2_frames, cracked2_frames_name) def idling(self): if not self.cracked1 and self.health <= c.TALLNUT_CRACKED1_HEALTH: @@ -1477,13 +1469,13 @@ class TangleKlep(Plant): self.splash_frames = [] idle_name = self.name - splash_name = self.name + 'Splash' + splash_name = self.name + "Splash" frame_list = [self.idle_frames, self.splash_frames] name_list = [idle_name, splash_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -1505,7 +1497,7 @@ class TangleKlep(Plant): self.changeFrames(self.splash_frames) self.attack_zombie.kill() # 播放拖拽音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "tangleKelpDrag.ogg")).play() + c.SOUND_TANGLE_KELP_DRAG.play() # 这里必须用elif排除尚未进入splash阶段,以免误触 elif (self.frame_index + 1) >= self.frame_num: self.health = 0 @@ -1536,14 +1528,14 @@ class DoomShroom(Plant): self.boom_frames = [] idle_name = name - sleep_name = name + 'Sleep' - boom_name = name + 'Boom' + sleep_name = name + "Sleep" + boom_name = name + "Boom" frame_list = [self.idle_frames, self.sleep_frames, self.boom_frames] name_list = [idle_name, sleep_name, boom_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -1558,7 +1550,7 @@ class DoomShroom(Plant): self.rect.x -= 80 self.rect.y += 30 # 播放爆炸音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "doomshroom.ogg")).play() + c.SOUND_DOOMSHROOM.play() if (self.current_time - self.animate_timer) > self.animate_interval: self.frame_index += 1 if self.frame_index >= self.frame_num: @@ -1610,11 +1602,11 @@ class Hole(Plant): self.roof2_frames = [] idle_name = name - idle2_name = name + 'Shallow' - water_name = name + 'Water' - water2_name = name + 'WaterShallow' - roof_name = name + 'Roof' - roof2_name = name + 'RoofShallow' + idle2_name = name + "Shallow" + water_name = name + "Water" + water2_name = name + "WaterShallow" + roof_name = name + "Roof" + roof2_name = name + "RoofShallow" frame_list = [ self.idle_frames, self.idle2_frames, self.water_frames, self.water2_frames, @@ -1624,7 +1616,7 @@ class Hole(Plant): roof_name, roof2_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1) + self.loadFrames(frame_list[i], name) if self.plotType == c.MAP_TILE: self.frames = self.roof_frames @@ -1667,8 +1659,7 @@ class GraveBuster(Plant): self.plant_group = plant_group self.animate_interval = 100 # 播放吞噬音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "gravebusterchomp.ogg")).play() - + c.SOUND_GRAVEBUSTER_CHOMP.play() def animation(self): if (self.current_time - self.animate_timer) > self.animate_interval: @@ -1707,14 +1698,14 @@ class FumeShroom(Plant): self.attack_frames = [] idle_name = name - sleep_name = name + 'Sleep' - attack_name = name + 'Attack' + sleep_name = name + "Sleep" + attack_name = name + "Attack" frame_list = [self.idle_frames, self.sleep_frames, self.attack_frames] name_list = [idle_name, sleep_name, attack_name] for i, name in enumerate(name_list): - self.loadFrames(frame_list[i], name, 1, c.BLACK) + self.loadFrames(frame_list[i], name) self.frames = self.idle_frames @@ -1748,7 +1739,7 @@ class FumeShroom(Plant): self.shoot_timer = self.current_time self.showAttackFrames = True # 播放发射音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "fume.ogg")).play() + c.SOUND_FUME.play() def animation(self): if (self.current_time - self.animate_timer) > self.animate_interval: @@ -1794,11 +1785,11 @@ class Garlic(Plant): self.cracked1_frames = [] self.cracked2_frames = [] - cracked1_frames_name = self.name + '_cracked1' - cracked2_frames_name = self.name + '_cracked2' + cracked1_frames_name = self.name + "_cracked1" + cracked2_frames_name = self.name + "_cracked2" - self.loadFrames(self.cracked1_frames, cracked1_frames_name, 1) - self.loadFrames(self.cracked2_frames, cracked2_frames_name, 1) + self.loadFrames(self.cracked1_frames, cracked1_frames_name) + self.loadFrames(self.cracked2_frames, cracked2_frames_name) def idling(self): if (not self.cracked1) and self.health <= c.GARLIC_CRACKED1_HEALTH: @@ -1807,3 +1798,29 @@ class Garlic(Plant): elif (not self.cracked2) and self.health <= c.GARLIC_CRACKED2_HEALTH: self.changeFrames(self.cracked2_frames) self.cracked2 = True + +class PumpkinHead(Plant): + def __init__(self, x, y): + Plant.__init__(self, x, y, c.PUMPKINHEAD, c.WALLNUT_HEALTH, None) + self.load_images() + self.cracked1 = False + self.cracked2 = False + self.animate_interval = 160 + + def load_images(self): + self.cracked1_frames = [] + self.cracked2_frames = [] + + cracked1_frames_name = self.name + "_cracked1" + cracked2_frames_name = self.name + "_cracked2" + + self.loadFrames(self.cracked1_frames, cracked1_frames_name) + self.loadFrames(self.cracked2_frames, cracked2_frames_name) + + def idling(self): + if not self.cracked1 and self.health <= c.WALLNUT_CRACKED1_HEALTH: + self.changeFrames(self.cracked1_frames) + self.cracked1 = True + elif not self.cracked2 and self.health <= c.WALLNUT_CRACKED2_HEALTH: + self.changeFrames(self.cracked2_frames) + self.cracked2 = True diff --git a/source/component/zombie.py b/source/component/zombie.py index 2b0adab..fc0ecaa 100755 --- a/source/component/zombie.py +++ b/source/component/zombie.py @@ -1,5 +1,4 @@ import pygame as pg -import os import random from .. import tool from .. import constants as c @@ -60,9 +59,9 @@ class Zombie(pg.sprite.Sprite): frame_list = tool.GFX[name] rect = frame_list[0].get_rect() width, height = rect.w, rect.h - if name in tool.ZOMBIE_RECT: - data = tool.ZOMBIE_RECT[name] - x, width = data['x'], data['width'] + if name in c.ZOMBIE_RECT: + data = c.ZOMBIE_RECT[name] + x, width = data["x"], data["width"] else: x = 0 for frame in frame_list: @@ -117,7 +116,7 @@ class Zombie(pg.sprite.Sprite): self.swimming = True self.changeFrames(self.swim_frames) # 播放入水音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zombieEnteringWater.ogg")).play() + c.SOUND_ZOMBIE_ENTERING_WATER.play() # 同样没有兼容双防具 if self.helmet: if self.helmetHealth <= 0: @@ -256,7 +255,7 @@ class Zombie(pg.sprite.Sprite): self.prey.setDamage(self.damage) # 播放啃咬音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zombieAttack.ogg")).play() + c.SOUND_ZOMBIE_ATTACKING.play() self.attack_timer = self.current_time if self.prey.health <= 0: @@ -288,7 +287,7 @@ class Zombie(pg.sprite.Sprite): self.head_group.add(ZombieHead(self.rect.centerx, self.rect.bottom)) def changeFrames(self, frames): - '''change image frames and modify rect position''' + """change image frames and modify rect position""" self.frames = frames self.frame_num = len(self.frames) self.frame_index = 0 @@ -333,7 +332,7 @@ class Zombie(pg.sprite.Sprite): def setIceSlow(self): # 在转入冰冻减速状态时播放冰冻音效 if self.ice_slow_ratio == 1: - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "freeze.ogg")).play() + c.SOUND_FREEZE.play() # when get a ice bullet damage, slow the attack or walk speed of the zombie self.ice_slow_timer = self.current_time @@ -432,7 +431,7 @@ class Zombie(pg.sprite.Sprite): else: # 没有防具 self.health -= damage else: - print('警告:植物攻击类型错误,现在默认进行类豌豆射手型攻击') + print("警告:植物攻击类型错误,现在默认进行类豌豆射手型攻击") self.setDamage(damage, effect=effect, damageType=c.ZOMBIE_DEAFULT_DAMAGE) # 记录攻击时间 @@ -509,7 +508,7 @@ class Zombie(pg.sprite.Sprite): self.is_hypno = True self.setWalk() # 播放魅惑音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "hypnoed.ogg")).play() + c.SOUND_HYPNOED.play() class ZombieHead(Zombie): @@ -540,10 +539,10 @@ class NormalZombie(Zombie): self.boomdie_frames = [] walk_name = self.name - attack_name = self.name + 'Attack' - losthead_walk_name = self.name + 'LostHead' - losthead_attack_name = self.name + 'LostHeadAttack' - die_name = self.name + 'Die' + attack_name = self.name + "Attack" + losthead_walk_name = self.name + "LostHead" + losthead_attack_name = self.name + "LostHeadAttack" + die_name = self.name + "Die" boomdie_name = c.BOOMDIE frame_list = [self.walk_frames, self.attack_frames, self.losthead_walk_frames, @@ -572,12 +571,12 @@ class ConeHeadZombie(Zombie): self.boomdie_frames = [] helmet_walk_name = self.name - helmet_attack_name = self.name + 'Attack' + helmet_attack_name = self.name + "Attack" walk_name = c.NORMAL_ZOMBIE - attack_name = c.NORMAL_ZOMBIE + 'Attack' - losthead_walk_name = c.NORMAL_ZOMBIE + 'LostHead' - losthead_attack_name = c.NORMAL_ZOMBIE + 'LostHeadAttack' - die_name = c.NORMAL_ZOMBIE + 'Die' + attack_name = c.NORMAL_ZOMBIE + "Attack" + losthead_walk_name = c.NORMAL_ZOMBIE + "LostHead" + losthead_attack_name = c.NORMAL_ZOMBIE + "LostHeadAttack" + die_name = c.NORMAL_ZOMBIE + "Die" boomdie_name = c.BOOMDIE frame_list = [self.helmet_walk_frames, self.helmet_attack_frames, @@ -608,12 +607,12 @@ class BucketHeadZombie(Zombie): self.boomdie_frames = [] helmet_walk_name = self.name - helmet_attack_name = self.name + 'Attack' + helmet_attack_name = self.name + "Attack" walk_name = c.NORMAL_ZOMBIE - attack_name = c.NORMAL_ZOMBIE + 'Attack' - losthead_walk_name = c.NORMAL_ZOMBIE + 'LostHead' - losthead_attack_name = c.NORMAL_ZOMBIE + 'LostHeadAttack' - die_name = c.NORMAL_ZOMBIE + 'Die' + attack_name = c.NORMAL_ZOMBIE + "Attack" + losthead_walk_name = c.NORMAL_ZOMBIE + "LostHead" + losthead_attack_name = c.NORMAL_ZOMBIE + "LostHeadAttack" + die_name = c.NORMAL_ZOMBIE + "Die" boomdie_name = c.BOOMDIE frame_list = [self.helmet_walk_frames, self.helmet_attack_frames, @@ -643,10 +642,10 @@ class FlagZombie(Zombie): self.boomdie_frames = [] walk_name = self.name - attack_name = self.name + 'Attack' - losthead_walk_name = self.name + 'LostHead' - losthead_attack_name = self.name + 'LostHeadAttack' - die_name = c.NORMAL_ZOMBIE + 'Die' + attack_name = self.name + "Attack" + losthead_walk_name = self.name + "LostHead" + losthead_attack_name = self.name + "LostHeadAttack" + die_name = c.NORMAL_ZOMBIE + "Die" boomdie_name = c.BOOMDIE frame_list = [self.walk_frames, self.attack_frames, self.losthead_walk_frames, @@ -677,13 +676,13 @@ class NewspaperZombie(Zombie): self.boomdie_frames = [] helmet_walk_name = self.name - helmet_attack_name = self.name + 'Attack' - walk_name = self.name + 'NoPaper' - attack_name = self.name + 'NoPaperAttack' - losthead_walk_name = self.name + 'LostHead' - losthead_attack_name = self.name + 'LostHeadAttack' - lostnewspaper_name = self.name + 'LostNewspaper' - die_name = self.name + 'Die' + helmet_attack_name = self.name + "Attack" + walk_name = self.name + "NoPaper" + attack_name = self.name + "NoPaperAttack" + losthead_walk_name = self.name + "LostHead" + losthead_attack_name = self.name + "LostHeadAttack" + lostnewspaper_name = self.name + "LostNewspaper" + die_name = self.name + "Die" boomdie_name = c.BOOMDIE frame_list = [self.helmet_walk_frames, self.helmet_attack_frames, @@ -712,7 +711,7 @@ class NewspaperZombie(Zombie): self.changeFrames(self.lostnewspaper_frames) self.helmetType2 = False # 触发报纸撕裂音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "newspaperRip.ogg")).play() + c.SOUND_NEWSPAPER_RIP.play() if ((self.current_time - self.walk_timer) > (c.ZOMBIE_WALK_INTERVAL * self.getTimeRatio())): self.handleGarlicYChange() self.walk_timer = self.current_time @@ -740,7 +739,7 @@ class NewspaperZombie(Zombie): self.speed = 2.65 self.walk_animate_interval = 300 # 触发报纸僵尸暴走音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "newspaperZombieAngry.ogg")).play() + c.SOUND_NEWSPAPER_ZOMBIE_ANGRY.play() return self.frame_index = 0 self.animate_timer = self.current_time @@ -775,12 +774,12 @@ class FootballZombie(Zombie): self.boomdie_frames = [] helmet_walk_name = self.name - helmet_attack_name = self.name + 'Attack' - walk_name = self.name + 'LostHelmet' - attack_name = self.name + 'LostHelmetAttack' - losthead_walk_name = self.name + 'LostHead' - losthead_attack_name = self.name + 'LostHeadAttack' - die_name = self.name + 'Die' + helmet_attack_name = self.name + "Attack" + walk_name = self.name + "LostHelmet" + attack_name = self.name + "LostHelmetAttack" + losthead_walk_name = self.name + "LostHead" + losthead_attack_name = self.name + "LostHeadAttack" + die_name = self.name + "Die" boomdie_name = c.BOOMDIE frame_list = [self.helmet_walk_frames, self.helmet_attack_frames, @@ -809,11 +808,11 @@ class DuckyTubeZombie(Zombie): self.boomdie_frames = [] walk_name = self.name - swim_name = self.name + 'Swim' - attack_name = self.name + 'Attack' - losthead_walk_name = self.name + 'LostHead' - losthead_attack_name = self.name + 'LostHead' - die_name = self.name + 'Die' + swim_name = self.name + "Swim" + attack_name = self.name + "Attack" + losthead_walk_name = self.name + "LostHead" + losthead_attack_name = self.name + "LostHead" + die_name = self.name + "Die" boomdie_name = c.BOOMDIE frame_list = [self.walk_frames, self.swim_frames, self.attack_frames, self.losthead_walk_frames, @@ -843,14 +842,14 @@ class ConeHeadDuckyTubeZombie(Zombie): self.boomdie_frames = [] helmet_walk_name = self.name - helmet_swim_name = self.name + 'Swim' - helmet_attack_name = self.name + 'Attack' + helmet_swim_name = self.name + "Swim" + helmet_attack_name = self.name + "Attack" walk_name = c.DUCKY_TUBE_ZOMBIE - swim_name = c.DUCKY_TUBE_ZOMBIE + 'Swim' - attack_name = c.DUCKY_TUBE_ZOMBIE + 'Attack' - losthead_walk_name = c.DUCKY_TUBE_ZOMBIE + 'LostHead' - losthead_attack_name = c.DUCKY_TUBE_ZOMBIE + 'LostHead' - die_name = c.DUCKY_TUBE_ZOMBIE + 'Die' + swim_name = c.DUCKY_TUBE_ZOMBIE + "Swim" + attack_name = c.DUCKY_TUBE_ZOMBIE + "Attack" + losthead_walk_name = c.DUCKY_TUBE_ZOMBIE + "LostHead" + losthead_attack_name = c.DUCKY_TUBE_ZOMBIE + "LostHead" + die_name = c.DUCKY_TUBE_ZOMBIE + "Die" boomdie_name = c.BOOMDIE frame_list = [self.helmet_walk_frames, self.helmet_swim_frames, self.helmet_attack_frames, self.walk_frames, self.swim_frames, self.attack_frames, self.losthead_walk_frames, @@ -881,14 +880,14 @@ class BucketHeadDuckyTubeZombie(Zombie): self.boomdie_frames = [] helmet_walk_name = self.name - helmet_swim_name = self.name + 'Swim' - helmet_attack_name = self.name + 'Attack' + helmet_swim_name = self.name + "Swim" + helmet_attack_name = self.name + "Attack" walk_name = c.DUCKY_TUBE_ZOMBIE - swim_name = c.DUCKY_TUBE_ZOMBIE + 'Swim' - attack_name = c.DUCKY_TUBE_ZOMBIE + 'Attack' - losthead_walk_name = c.DUCKY_TUBE_ZOMBIE + 'LostHead' - losthead_attack_name = c.DUCKY_TUBE_ZOMBIE + 'LostHead' - die_name = c.DUCKY_TUBE_ZOMBIE + 'Die' + swim_name = c.DUCKY_TUBE_ZOMBIE + "Swim" + attack_name = c.DUCKY_TUBE_ZOMBIE + "Attack" + losthead_walk_name = c.DUCKY_TUBE_ZOMBIE + "LostHead" + losthead_attack_name = c.DUCKY_TUBE_ZOMBIE + "LostHead" + die_name = c.DUCKY_TUBE_ZOMBIE + "Die" boomdie_name = c.BOOMDIE frame_list = [self.helmet_walk_frames, self.helmet_swim_frames, self.helmet_attack_frames, self.walk_frames, self.swim_frames, self.attack_frames, self.losthead_walk_frames, @@ -917,12 +916,12 @@ class ScreenDoorZombie(Zombie): self.boomdie_frames = [] helmet_walk_name = self.name - helmet_attack_name = self.name + 'Attack' + helmet_attack_name = self.name + "Attack" walk_name = c.NORMAL_ZOMBIE - attack_name = c.NORMAL_ZOMBIE + 'Attack' - losthead_walk_name = c.NORMAL_ZOMBIE + 'LostHead' - losthead_attack_name = c.NORMAL_ZOMBIE + 'LostHeadAttack' - die_name = c.NORMAL_ZOMBIE + 'Die' + attack_name = c.NORMAL_ZOMBIE + "Attack" + losthead_walk_name = c.NORMAL_ZOMBIE + "LostHead" + losthead_attack_name = c.NORMAL_ZOMBIE + "LostHeadAttack" + die_name = c.NORMAL_ZOMBIE + "Die" boomdie_name = c.BOOMDIE frame_list = [self.helmet_walk_frames, self.helmet_attack_frames, @@ -955,14 +954,14 @@ class PoleVaultingZombie(Zombie): self.walk_before_jump_frames = [] self.jump_frames = [] - walk_name = self.name + 'WalkAfterJump' - attack_name = self.name + 'Attack' - losthead_walk_name = self.name + 'LostHead' - losthead_attack_name = self.name + 'LostHeadAttack' - die_name = self.name + 'Die' + walk_name = self.name + "WalkAfterJump" + attack_name = self.name + "Attack" + losthead_walk_name = self.name + "LostHead" + losthead_attack_name = self.name + "LostHeadAttack" + die_name = self.name + "Die" boomdie_name = c.BOOMDIE walk_before_jump_name = self.name - jump_name = self.name + 'Jump' + jump_name = self.name + "Jump" frame_list = [self.walk_frames, self.attack_frames, self.losthead_walk_frames, self.losthead_attack_frames, self.die_frames, self.boomdie_frames, @@ -983,7 +982,7 @@ class PoleVaultingZombie(Zombie): self.successfullyJumped = successfullyJumped self.jumpX = jumpX # 播放跳跃音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "polevaultjump.ogg")).play() + c.SOUND_POLEVAULT_JUMP.play() def animation(self): if self.state == c.FREEZE: @@ -1051,7 +1050,7 @@ class Zomboni(Zombie): self.die_animate_interval = 70 self.boomDie_animate_interval = 150 # 播放冰车生成音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zomboni.ogg")).play() + c.SOUND_ZOMBONI.play() def loadImages(self): self.walk_frames = [] @@ -1062,11 +1061,11 @@ class Zomboni(Zombie): self.boomdie_frames = [] walk_name = self.name - walk_damaged1_name = self.name + 'Damaged1' - walk_damaged2_name = self.name + 'Damaged2' - losthead_walk_name = self.name + 'Damaged2' - die_name = self.name + 'Die' - boomdie_name = self.name + 'BoomDie' + walk_damaged1_name = self.name + "Damaged1" + walk_damaged2_name = self.name + "Damaged2" + losthead_walk_name = self.name + "Damaged2" + die_name = self.name + "Die" + boomdie_name = self.name + "BoomDie" frame_list = [ self.walk_frames, self.walk_damaged1_frames, self.walk_damaged2_frames, self.losthead_walk_frames, @@ -1126,7 +1125,7 @@ class Zomboni(Zombie): self.animate_interval = self.die_animate_interval self.changeFrames(self.die_frames) # 播放冰车爆炸音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zomboniExplosion.ogg")).play() + c.SOUND_ZOMBONI_EXPLOSION.play() class SnorkelZombie(Zombie): @@ -1149,14 +1148,14 @@ class SnorkelZombie(Zombie): self.boomdie_frames = [] walk_name = self.name - swim_name = self.name + 'Dive' - attack_name = self.name + 'Attack' - jump_name = self.name + 'Jump' - float_name = self.name + 'Float' - sink_name = self.name + 'Sink' - losthead_walk_name = self.name + 'LostHead' - losthead_attack_name = self.name + 'LostHeadAttack' - die_name = self.name + 'Die' + swim_name = self.name + "Dive" + attack_name = self.name + "Attack" + jump_name = self.name + "Jump" + float_name = self.name + "Float" + sink_name = self.name + "Sink" + losthead_walk_name = self.name + "LostHead" + losthead_attack_name = self.name + "LostHeadAttack" + die_name = self.name + "Die" boomdie_name = c.BOOMDIE frame_list = [ self.walk_frames, self.swim_frames, @@ -1189,7 +1188,7 @@ class SnorkelZombie(Zombie): self.swimming = True self.changeFrames(self.jump_frames) # 播放入水音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zombieEnteringWater.ogg")).play() + c.SOUND_ZOMBIE_ENTERING_WATER.play() # 已经接近家门口并且上岸 else: if self.swimming: diff --git a/source/constants.py b/source/constants.py index fba31bf..dc9e2e8 100755 --- a/source/constants.py +++ b/source/constants.py @@ -1,35 +1,37 @@ import os -# 用户数据存储路径 -if os.name == 'nt': # Windows系统存储路径 +import pygame as pg + +# 用户数据及日志存储路径 +if os.name == "nt": # Windows系统存储路径 USERDATA_PATH = os.path.expandvars(os.path.join("%APPDATA%", "wszqkzqk.dev", "pypvz", "userdata.json")) + USERLOG_PATH = os.path.expandvars(os.path.join("%APPDATA%", "wszqkzqk.dev", "pypvz", "run.log")) else: # 非Windows系统存储路径 USERDATA_PATH = os.path.expanduser(os.path.join("~", ".config", "wszqkzqk.dev", "pypvz", "userdata.json")) + USERLOG_PATH = os.path.expanduser(os.path.join("~", ".config", "wszqkzqk.dev", "pypvz", "run.log")) -# 游戏起始关卡 -START_LEVEL_NUM = 1 -START_LITTLE_GAME_NUM = 1 -# 游戏模式完成次数 -START_LEVEL_COMPLETIONS = 0 -START_LITTLEGAME_COMPLETIONS = 0 - -# 游戏速度倍率(调试用) -GAME_RATE = 1 +# 窗口图标 +ORIGINAL_LOGO = os.path.join(os.path.dirname(os.path.dirname(__file__)), "pypvz-exec-logo.png") +# 游戏图片资源路径 +PATH_IMG_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "resources", "graphics") +# 游戏音乐文件夹路径 +PATH_MUSIC_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "resources","music") # 窗口标题 -ORIGINAL_CAPTION = 'pypvz' -# 窗口图标 -ORIGINAL_LOGO = "pypvz-exec-logo.png" +ORIGINAL_CAPTION = "pypvz" # 游戏模式 -GAME_MODE = 'mode' -MODE_ADVENTURE = 'adventure' -MODE_LITTLEGAME = 'littleGame' +GAME_MODE = "mode" +MODE_ADVENTURE = "adventure" +MODE_LITTLEGAME = "littleGame" # 窗口大小 SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 SCREEN_SIZE = (SCREEN_WIDTH, SCREEN_HEIGHT) +# 字体路径 +FONT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), "resources", "DroidSansFallback.ttf") + # 选卡数量 # 最大数量 CARD_MAX_NUM = 10 # 这里以后可以增加解锁功能,从最初的6格逐渐解锁到10格 @@ -63,52 +65,64 @@ RED = (255, 0, 0) PURPLE = (255, 0, 255) GOLD = (255, 215, 0) GREEN = ( 0, 255, 0) +YELLOWGREEN = ( 55, 200, 0) +LIGHTGRAY = (107, 108, 145) +PARCHMENT_YELLOW = (207, 146, 83) # 退出游戏按钮 -EXIT = 'exit' +EXIT = "exit" # 游戏界面可选的菜单 -LITTLE_MENU = 'littleMenu' -BIG_MENU = 'bigMenu' -RETURN_BUTTON = 'returnButton' -RESTART_BUTTON = 'restartButton' -MAINMENU_BUTTON = 'mainMenuButton' -LITTLEGAME_BUTTON = 'littleGameButton' +LITTLE_MENU = "littleMenu" +BIG_MENU = "bigMenu" +RESTART_BUTTON = "restartButton" +MAINMENU_BUTTON = "mainMenuButton" +LITTLEGAME_BUTTON = "littleGameButton" +OPTION_BUTTON = "optionButton" +SOUND_VOLUME_BUTTON = "volumeButton" +UNIVERSAL_BUTTON = "universalButton" +# 金银向日葵奖杯 +TROPHY_SUNFLOWER = "sunflowerTrophy" # 小铲子 -SHOVEL = 'shovel' -SHOVEL_BOX = 'shovelBox' +SHOVEL = "shovel" +SHOVEL_BOX = "shovelBox" # 一大波僵尸来袭图片 -HUGE_WAVE_APPROCHING = 'Approching' +HUGE_WAVE_APPROCHING = "Approching" # 关卡进程图片 -LEVEL_PROGRESS_BAR = 'LevelProgressBar' -LEVEL_PROGRESS_ZOMBIE_HEAD = 'LevelProgressZombieHead' -LEVEL_PROGRESS_FLAG = 'LevelProgressFlag' +LEVEL_PROGRESS_BAR = "LevelProgressBar" +LEVEL_PROGRESS_ZOMBIE_HEAD = "LevelProgressZombieHead" +LEVEL_PROGRESS_FLAG = "LevelProgressFlag" # GAME INFO字典键值 -CURRENT_TIME = 'current time' -LEVEL_NUM = 'level num' -LITTLEGAME_NUM = 'littleGame num' -LEVEL_COMPLETIONS = 'level completions' -LITTLEGAME_COMPLETIONS = 'littleGame completions' +CURRENT_TIME = "current time" +PASSED_ALL = "passed all" # 已完成该模式下的所有游戏,应当显示向日葵奖杯获得界面 +LEVEL_NUM = "level num" +LITTLEGAME_NUM = "littleGame num" +LEVEL_COMPLETIONS = "level completions" +LITTLEGAME_COMPLETIONS = "littleGame completions" +GAME_RATE = "game rate" +SOUND_VOLUME = "volume" # 整个游戏的状态 -MAIN_MENU = 'main menu' -LOAD_SCREEN = 'load screen' -GAME_LOSE = 'game los' -GAME_VICTORY = 'game victory' -LEVEL = 'level' +MAIN_MENU = "main menu" +LOAD_SCREEN = "load screen" +GAME_LOSE = "game lose" +GAME_VICTORY = "game victory" +LEVEL = "level" +AWARD_SCREEN = "award screen" # 界面图片文件名 -MAIN_MENU_IMAGE = 'MainMenu' -OPTION_ADVENTURE = 'Adventure' -GAME_LOSE_IMAGE = 'GameLose' -GAME_VICTORY_IMAGE = 'GameVictory' +MAIN_MENU_IMAGE = "MainMenu" +OPTION_ADVENTURE = "Adventure" +GAME_LOSE_IMAGE = "GameLose" +GAME_VICTORY_IMAGE = "GameVictory" +AWARD_SCREEN_IMAGE = "AwardScreen" # 地图相关内容 -BACKGROUND_NAME = 'Background' -BACKGROUND_TYPE = 'background_type' -INIT_SUN_NAME = 'init_sun_value' -ZOMBIE_LIST = 'zombie_list' +BACKGROUND_NAME = "Background" +BACKGROUND_TYPE = "background_type" +INIT_SUN_NAME = "init_sun_value" +ZOMBIE_LIST = "zombie_list" # 地图类型 BACKGROUND_DAY = 0 @@ -146,34 +160,28 @@ BACKGROUND_DAY_LIKE_BACKGROUNDS = { } # 夜晚地图的墓碑数量等级 -GRADE_GRAVES = 'grade_graves' +GRADE_GRAVES = "grade_graves" # 不同墓碑等级对应的信息,列表位置对应的是墓碑等级 GRAVES_GRADE_INFO = (0, 4, 7, 11) # 僵尸生成方式 -SPAWN_ZOMBIES = 'spawn_zombies' -SPAWN_ZOMBIES_AUTO = 'auto' -SPAWN_ZOMBIES_LIST = 'list' -INCLUDED_ZOMBIES = 'included_zombies' -NUM_FLAGS = 'num_flags' -INEVITABLE_ZOMBIE_DICT = 'inevitable_zombie_list' -SURVIVAL_ROUNDS = 'survival_rounds' +SPAWN_ZOMBIES = "spawn_zombies" +SPAWN_ZOMBIES_AUTO = "auto" +SPAWN_ZOMBIES_LIST = "list" +INCLUDED_ZOMBIES = "included_zombies" +NUM_FLAGS = "num_flags" +INEVITABLE_ZOMBIE_DICT = "inevitable_zombie_list" +SURVIVAL_ROUNDS = "survival_rounds" # 地图单元格属性 -MAP_PLANT = 'plantnames' -MAP_SLEEP = 'sleep' # 有没有休眠的蘑菇,作是否能种植咖啡豆的判断 -MAP_PLOT_TYPE = 'plotType' +MAP_PLANT = "plantnames" +MAP_SLEEP = "sleep" # 有没有休眠的蘑菇,作是否能种植咖啡豆的判断 +MAP_PLOT_TYPE = "plotType" # 地图单元格区域类型 -MAP_GRASS = 'grass' -MAP_WATER = 'water' -MAP_TILE = 'tile' # 指屋顶上的瓦片 -MAP_UNAVAILABLE = 'unavailable' # 指完全不能种植物的地方,包括无草皮的荒地和坚果保龄球等红线右侧 -# 地图单元格状态 -# 注意是可变对象,不能直接引用 -# 不喜欢用深拷贝,直接改用函数表示,需要时直接调用该函数生成即可 -# 由于同一格显然不可能种两个相同的植物,所以用集合 -def INIT_MAP_GRID(PLOT_TYPE): - return {MAP_PLANT:set(), MAP_SLEEP:False, MAP_PLOT_TYPE:PLOT_TYPE} +MAP_GRASS = "grass" +MAP_WATER = "water" +MAP_TILE = "tile" # 指屋顶上的瓦片 +MAP_UNAVAILABLE = "unavailable" # 指完全不能种植物的地方,包括无草皮的荒地和坚果保龄球等红线右侧 # 地图相关像素数据 BACKGROUND_OFFSET_X = 220 @@ -188,15 +196,15 @@ MAP_ROOF_OFFSET_Y = 105 # 暂时还不清楚数据 MAP_POOL_FRONT_X = SCREEN_WIDTH - 15 # 植物选择菜单栏、传送带菜单栏等类型设定 -CHOOSEBAR_TYPE = 'choosebar_type' +CHOOSEBAR_TYPE = "choosebar_type" CHOOSEBAR_STATIC = 0 CHOOSEBAR_MOVE = 1 -CHOSSEBAR_BOWLING = 2 -MENUBAR_BACKGROUND = 'ChooserBackground' -MOVEBAR_BACKGROUND = 'MoveBackground' -PANEL_BACKGROUND = 'PanelBackground' -START_BUTTON = 'StartButton' -CARD_POOL = 'card_pool' +CHOOSEBAR_BOWLING = 2 +MENUBAR_BACKGROUND = "ChooserBackground" +MOVEBAR_BACKGROUND = "MoveBackground" +PANEL_BACKGROUND = "PanelBackground" +START_BUTTON = "StartButton" +CARD_POOL = "card_pool" # 关于植物栏的像素设置 PANEL_Y_START = 87 @@ -216,45 +224,156 @@ MOVEBAR_CARD_FRESH_TIME = 6000 CARD_MOVE_TIME = 60 # 其他显示物 -CAR = 'car' -SUN = 'Sun' +CAR = "car" +SUN = "Sun" + +# plant子类非植物对象 +NON_PLANT_OBJECTS = { + HOLE := "Hole", + ICEFROZENPLOT := "IceFrozenPlot", + GRAVE := "Grave", + } + # 植物相关信息 -PLANT_IMAGE_RECT = 'plant_image_rect' -# 植物名称 -SUNFLOWER = 'SunFlower' -PEASHOOTER = 'Peashooter' -SNOWPEASHOOTER = 'SnowPea' -WALLNUT = 'WallNut' -CHERRYBOMB = 'CherryBomb' -THREEPEASHOOTER = 'Threepeater' -REPEATERPEA = 'RepeaterPea' -CHOMPER = 'Chomper' -CHERRY_BOOM_IMAGE = 'Boom' -PUFFSHROOM = 'PuffShroom' -POTATOMINE = 'PotatoMine' -SQUASH = 'Squash' -SPIKEWEED = 'Spikeweed' -JALAPENO = 'Jalapeno' -SCAREDYSHROOM = 'ScaredyShroom' -SUNSHROOM = 'SunShroom' -ICESHROOM = 'IceShroom' -HYPNOSHROOM = 'HypnoShroom' -WALLNUTBOWLING = 'WallNutBowling' -REDWALLNUTBOWLING = 'RedWallNutBowling' -LILYPAD = 'LilyPad' -TORCHWOOD = 'TorchWood' -STARFRUIT = 'StarFruit' -COFFEEBEAN = 'CoffeeBean' -SEASHROOM = 'SeaShroom' -TALLNUT = 'TallNut' -TANGLEKLEP = 'TangleKlep' -DOOMSHROOM = 'DoomShroom' -ICEFROZENPLOT = 'IceFrozenPlot' -HOLE = 'Hole' -GRAVE = 'Grave' -GRAVEBUSTER = 'GraveBuster' -FUMESHROOM = 'FumeShroom' -GARLIC = 'Garlic' +PLANT_IMAGE_RECT = "plant_image_rect" +BOOM_IMAGE = "Boom" + +# 植物卡片信息汇总(包括植物名称, 卡片名称, 阳光, 冷却时间) +PLANT_CARD_INFO = (# 元组 (植物名称, 卡片名称, 阳光, 冷却时间) + (PEASHOOTER := "Peashooter", + CARD_PEASHOOTER := "card_peashooter", + 100, + 7500), + (SUNFLOWER := "SunFlower", + CARD_SUNFLOWER := "card_sunflower", + 50, + 7500), + (CHERRYBOMB := "CherryBomb", + CARD_CHERRYBOMB := "card_cherrybomb", + 150, + 50000), + (WALLNUT := "WallNut", + CARD_WALLNUT := "card_wallnut", + 50, + 30000), + (POTATOMINE := "PotatoMine", + CARD_POTATOMINE := "card_potatomine", + 25, + 30000), + (SNOWPEASHOOTER := "SnowPea", + CARD_SNOWPEASHOOTER := "card_snowpea", + 175, + 7500), + (CHOMPER := "Chomper", + CARD_CHOMPER := "card_chomper", + 150, + 7500), + (REPEATERPEA := "RepeaterPea", + CARD_REPEATERPEA := "card_repeaterpea", + 200, + 7500), + (PUFFSHROOM := "PuffShroom", + CARD_PUFFSHROOM := "card_puffshroom", + 0, + 7500), + (SUNSHROOM := "SunShroom", + CARD_SUNSHROOM := "card_sunshroom", + 25, + 7500), + (FUMESHROOM := "FumeShroom", + CARD_FUMESHROOM := "card_fumeshroom", + 75, + 7500), + (GRAVEBUSTER := "GraveBuster", + CARD_GRAVEBUSTER := "card_gravebuster", + 75, + 7500), + (HYPNOSHROOM := "HypnoShroom", + CARD_HYPNOSHROOM := "card_hypnoshroom", + 75, + 30000), + (SCAREDYSHROOM := "ScaredyShroom", + CARD_SCAREDYSHROOM := "card_scaredyshroom", + 25, + 7500), + (ICESHROOM := "IceShroom", + CARD_ICESHROOM := "card_iceshroom", + 75, + 50000), + (DOOMSHROOM := "DoomShroom", + CARD_DOOMSHROOM := "card_doomshroom", + 75, + 50000), + (LILYPAD := "LilyPad", + CARD_LILYPAD := "card_lilypad", + 25, + 7500), + (SQUASH := "Squash", + CARD_SQUASH := "card_squash", + 50, + 30000), + (TANGLEKLEP := "TangleKlep", + CARD_TANGLEKLEP := "card_tangleklep", + 25, + 30000), + (THREEPEASHOOTER := "Threepeater", + CARD_THREEPEASHOOTER := "card_threepeashooter", + 325, + 7500), + (JALAPENO := "Jalapeno", + CARD_JALAPENO := "card_jalapeno", + 125, + 50000), + (SPIKEWEED := "Spikeweed", + CARD_SPIKEWEED := "card_spikeweed", + 100, + 7500), + (TORCHWOOD := "TorchWood", + CARD_TORCHWOOD := "card_torchwood", + 175, + 7500), + (TALLNUT := "TallNut", + CARD_TALLNUT := "card_tallnut", + 125, + 30000), + (SEASHROOM := "SeaShroom", + CARD_SEASHROOM := "card_seashroom", + 0, + 30000), + (STARFRUIT := "StarFruit", + CARD_STARFRUIT := "card_starfruit", + 125, + 7500), + (PUMPKINHEAD := "PumpkinHead", + CARD_PUMPKINHEAD := "card_pumpkinhead", + 125, + 30000), + (COFFEEBEAN := "CoffeeBean", + CARD_COFFEEBEAN := "card_coffeebean", + 75, + 7500), + (GARLIC := "Garlic", + CARD_GARLIC := "card_garlic", + 50, + 7500), + # 应当保证这两个在一般模式下不可选的特殊植物恒在最后 + (WALLNUTBOWLING := "WallNutBowling", + CARD_WALLNUT := "card_wallnut", + 0, + 0), + (REDWALLNUTBOWLING := "RedWallNutBowling", + CARD_REDWALLNUT := "card_redwallnut", + 0, + 0), + ) + +# 卡片中的植物名称与索引序号的对应关系,指定名称以得到索引值 +PLANT_CARD_INDEX={} +for i, item in enumerate(PLANT_CARD_INFO): + PLANT_CARD_INDEX[item[PLANT_NAME_INDEX]] = i + +# 指定了哪些卡可选(排除坚果保龄球特殊植物) +CARDS_TO_CHOOSE = range(len(PLANT_CARD_INFO) - 2) # 植物集体属性集合 @@ -267,12 +386,6 @@ SKIP_ZOMBIE_COLLISION_CHECK_WHEN_WORKING = { POTATOMINE, } -# 非植物对象 -NON_PLANT_OBJECTS = { - HOLE, ICEFROZENPLOT, - GRAVE, - } - # 所有可能不用与僵尸进行碰撞检测的对象 CAN_SKIP_ZOMBIE_COLLISION_CHECK = ( # 这里运用了集合运算 # 注意这个外围的小括号是用来换行的 @@ -294,15 +407,6 @@ PLANT_DIE_SOUND_EXCEPTIONS = { REDWALLNUTBOWLING, CHERRYBOMB, } -# color_key为白色的对象 -PLANT_COLOR_KEY_WHITE = { - POTATOMINE, SPIKEWEED, - JALAPENO, SCAREDYSHROOM, - SUNSHROOM, ICESHROOM, - HYPNOSHROOM, SQUASH, - WALLNUTBOWLING, REDWALLNUTBOWLING, - } - # 直接水生植物 WATER_PLANTS = { LILYPAD, SEASHROOM, @@ -319,6 +423,7 @@ PLANT_NON_CHECK_ATTACK_STATE = ( # 这里运用了集合运算 SUNSHROOM, COFFEEBEAN, GRAVEBUSTER, LILYPAD, HYPNOSHROOM, GARLIC, + PUMPKINHEAD, } | # 非植物类 NON_PLANT_OBJECTS @@ -355,227 +460,61 @@ SUN_VALUE = 25 # 僵尸冷冻 ICE_SLOW_TIME = 10000 MIN_FREEZE_TIME = 4000 -ICETRAP = 'IceTrap' - -# 植物卡片名称 -CARD_SUNFLOWER = 'card_sunflower' -CARD_PEASHOOTER = 'card_peashooter' -CARD_SNOWPEASHOOTER = 'card_snowpea' -CARD_WALLNUT = 'card_wallnut' -CARD_CHERRYBOMB = 'card_cherrybomb' -CARD_THREEPEASHOOTER = 'card_threepeashooter' -CARD_REPEATERPEA = 'card_repeaterpea' -CARD_CHOMPER = 'card_chomper' -CARD_PUFFSHROOM = 'card_puffshroom' -CARD_POTATOMINE = 'card_potatomine' -CARD_SQUASH = 'card_squash' -CARD_SPIKEWEED = 'card_spikeweed' -CARD_JALAPENO = 'card_jalapeno' -CARD_SCAREDYSHROOM = 'card_scaredyshroom' -CARD_SUNSHROOM = 'card_sunshroom' -CARD_ICESHROOM = 'card_iceshroom' -CARD_HYPNOSHROOM = 'card_hypnoshroom' -CARD_REDWALLNUT = 'card_redwallnut' -CARD_LILYPAD = 'card_lilypad' -CARD_TORCHWOOD = 'card_torchwood' -CARD_STARFRUIT = 'card_starfruit' -CARD_COFFEEBEAN = 'card_coffeebean' -CARD_SEASHROOM = 'card_seashroom' -CARD_TALLNUT = 'card_tallnut' -CARD_TANGLEKLEP = 'card_tangleklep' -CARD_DOOMSHROOM = 'card_doomshroom' -CARD_GRAVEBUSTER = 'card_gravebuster' -CARD_FUMESHROOM = 'card_fumeshroom' -CARD_GARLIC = 'card_garlic' - - -# 植物卡片信息汇总(包括植物名称, 卡片名称, 阳光, 冷却时间) -PLANT_CARD_INFO = (# 元组 (植物名称, 卡片名称, 阳光, 冷却时间) - (PEASHOOTER, - CARD_PEASHOOTER, - 100, - 7500), - (SUNFLOWER, - CARD_SUNFLOWER, - 50, - 7500), - (CHERRYBOMB, - CARD_CHERRYBOMB, - 150, - 50000), - (WALLNUT, - CARD_WALLNUT, - 50, - 30000), - (POTATOMINE, - CARD_POTATOMINE, - 25, - 30000), - (SNOWPEASHOOTER, - CARD_SNOWPEASHOOTER, - 175, - 7500), - (CHOMPER, - CARD_CHOMPER, - 150, - 7500), - (REPEATERPEA, - CARD_REPEATERPEA, - 200, - 7500), - (PUFFSHROOM, - CARD_PUFFSHROOM, - 0, - 7500), - (SUNSHROOM, - CARD_SUNSHROOM, - 25, - 7500), - (FUMESHROOM, - CARD_FUMESHROOM, - 75, - 7500), - (GRAVEBUSTER, - CARD_GRAVEBUSTER, - 75, - 7500), - (HYPNOSHROOM, - CARD_HYPNOSHROOM, - 75, - 30000), - (SCAREDYSHROOM, - CARD_SCAREDYSHROOM, - 25, - 7500), - (ICESHROOM, - CARD_ICESHROOM, - 75, - 50000), - (DOOMSHROOM, - CARD_DOOMSHROOM, - 75, - 50000), - (LILYPAD, - CARD_LILYPAD, - 25, - 7500), - (SQUASH, - CARD_SQUASH, - 50, - 30000), - (TANGLEKLEP, - CARD_TANGLEKLEP, - 25, - 30000), - (THREEPEASHOOTER, - CARD_THREEPEASHOOTER, - 325, - 7500), - (JALAPENO, - CARD_JALAPENO, - 125, - 50000), - (SPIKEWEED, - CARD_SPIKEWEED, - 100, - 7500), - (TORCHWOOD, - CARD_TORCHWOOD, - 175, - 7500), - (TALLNUT, - CARD_TALLNUT, - 125, - 30000), - (SEASHROOM, - CARD_SEASHROOM, - 125, - 30000), - (STARFRUIT, - CARD_STARFRUIT, - 125, - 7500), - (COFFEEBEAN, - CARD_COFFEEBEAN, - 75, - 7500), - (GARLIC, - CARD_GARLIC, - 50, - 7500), - # 应当保证这两个在一般模式下不可选的特殊植物恒在最后 - (WALLNUTBOWLING, - CARD_WALLNUT, - 0, - 0), - (REDWALLNUTBOWLING, - CARD_REDWALLNUT, - 0, - 0), - ) - -# 卡片中的植物名称与索引序号的对应关系,指定名称以得到索引值 -PLANT_CARD_INDEX={} -for i, item in enumerate(PLANT_CARD_INFO): - PLANT_CARD_INDEX[item[PLANT_NAME_INDEX]] = i - -# 指定了哪些卡可选(排除坚果保龄球特殊植物) -CARDS_TO_CHOOSE = range(len(PLANT_CARD_INFO) - 2) - +ICETRAP = "IceTrap" # 子弹信息 # 子弹类型 -BULLET_PEA = 'PeaNormal' -BULLET_PEA_ICE = 'PeaIce' -BULLET_FIREBALL = 'Fireball' -BULLET_MUSHROOM = 'BulletMushRoom' -BULLET_SEASHROOM = 'BulletSeaShroom' -FUME = 'Fume' +BULLET_PEA = "PeaNormal" +BULLET_PEA_ICE = "PeaIce" +BULLET_FIREBALL = "Fireball" +BULLET_MUSHROOM = "BulletMushRoom" +BULLET_SEASHROOM = "BulletSeaShroom" +FUME = "Fume" # 子弹伤害 BULLET_DAMAGE_NORMAL = 20 BULLET_DAMAGE_FIREBALL_BODY = 27 # 这是火球本体的伤害,注意不是40,本体(27) + 溅射(13)才是40 BULLET_DAMAGE_FIREBALL_RANGE = 13 # 子弹效果 -BULLET_EFFECT_ICE = 'ice' -BULLET_EFFECT_UNICE = 'unice' +BULLET_EFFECT_ICE = "ice" +BULLET_EFFECT_UNICE = "unice" # 特殊子弹 # 杨桃子弹 # 子弹名称 -BULLET_STAR = 'StarBullet' +BULLET_STAR = "StarBullet" # 子弹方向 -STAR_FORWARD_UP = 'forwardUp' # 向前上方 -STAR_FORWARD_DOWN = 'forwardDown' #向前下方 -STAR_BACKWARD = 'backward' #向后 -STAR_UPWARD = 'upward' # 向上 -STAR_DOWNWARD = 'downward' # 向下 +STAR_FORWARD_UP = "forwardUp" # 向前上方 +STAR_FORWARD_DOWN = "forwardDown" #向前下方 +STAR_BACKWARD = "backward" #向后 +STAR_UPWARD = "upward" # 向上 +STAR_DOWNWARD = "downward" # 向下 # 僵尸信息 -ZOMBIE_IMAGE_RECT = 'zombie_image_rect' -ZOMBIE_HEAD = 'ZombieHead' -NORMAL_ZOMBIE = 'Zombie' -CONEHEAD_ZOMBIE = 'ConeheadZombie' -BUCKETHEAD_ZOMBIE = 'BucketheadZombie' -FLAG_ZOMBIE = 'FlagZombie' -NEWSPAPER_ZOMBIE = 'NewspaperZombie' -FOOTBALL_ZOMBIE = 'FootballZombie' -DUCKY_TUBE_ZOMBIE = 'DuckyTubeZombie' -CONEHEAD_DUCKY_TUBE_ZOMBIE = 'ConeheadDuckyTubeZombie' -BUCKETHEAD_DUCKY_TUBE_ZOMBIE = 'BucketheadDuckyTubeZombie' -SCREEN_DOOR_ZOMBIE = 'ScreenDoorZombie' -POLE_VAULTING_ZOMBIE = 'PoleVaultingZombie' -ZOMBONI = 'Zomboni' -SNORKELZOMBIE = 'SnorkelZombie' +ZOMBIE_IMAGE_RECT = "zombie_image_rect" +ZOMBIE_HEAD = "ZombieHead" +NORMAL_ZOMBIE = "Zombie" +CONEHEAD_ZOMBIE = "ConeheadZombie" +BUCKETHEAD_ZOMBIE = "BucketheadZombie" +FLAG_ZOMBIE = "FlagZombie" +NEWSPAPER_ZOMBIE = "NewspaperZombie" +FOOTBALL_ZOMBIE = "FootballZombie" +DUCKY_TUBE_ZOMBIE = "DuckyTubeZombie" +CONEHEAD_DUCKY_TUBE_ZOMBIE = "ConeheadDuckyTubeZombie" +BUCKETHEAD_DUCKY_TUBE_ZOMBIE = "BucketheadDuckyTubeZombie" +SCREEN_DOOR_ZOMBIE = "ScreenDoorZombie" +POLE_VAULTING_ZOMBIE = "PoleVaultingZombie" +ZOMBONI = "Zomboni" +SNORKELZOMBIE = "SnorkelZombie" -BOOMDIE = 'BoomDie' +BOOMDIE = "BoomDie" # 对僵尸的攻击类型设置 -ZOMBIE_DEAFULT_DAMAGE = 'helmet2First' -ZOMBIE_HELMET_2_FIRST = 'helmet2First' # 优先攻击二类防具 -ZOMBIE_COMMON_DAMAGE = 'commonDamage' # 优先攻击僵尸与一类防具的整体 -ZOMBIE_RANGE_DAMAGE = 'rangeDamage' # 范围攻击,同时伤害二类防具与(僵尸与一类防具的整体) -ZOMBIE_ASH_DAMAGE = 'ashDamage' # 灰烬植物攻击,直接伤害本体 -ZOMBIE_WALLNUT_BOWLING_DANMAGE = 'wallnutBowlingDamage' # 坚果保龄球冲撞伤害 +ZOMBIE_DEAFULT_DAMAGE = "helmet2First" +ZOMBIE_HELMET_2_FIRST = "helmet2First" # 优先攻击二类防具 +ZOMBIE_COMMON_DAMAGE = "commonDamage" # 优先攻击僵尸与一类防具的整体 +ZOMBIE_RANGE_DAMAGE = "rangeDamage" # 范围攻击,同时伤害二类防具与(僵尸与一类防具的整体) +ZOMBIE_ASH_DAMAGE = "ashDamage" # 灰烬植物攻击,直接伤害本体 +ZOMBIE_WALLNUT_BOWLING_DANMAGE = "wallnutBowlingDamage" # 坚果保龄球冲撞伤害 # 僵尸生命值设置 # 有关本体 @@ -638,27 +577,132 @@ WATER_ZOMBIE = { # 状态类型 -IDLE = 'idle' -FLY = 'fly' -EXPLODE = 'explode' -ATTACK = 'attack' -ATTACKED = 'attacked' -DIGEST = 'digest' -WALK = 'walk' -DIE = 'die' -CRY = 'cry' -FREEZE = 'freeze' -SLEEP = 'sleep' +IDLE = "idle" +FLY = "fly" +EXPLODE = "explode" +ATTACK = "attack" +ATTACKED = "attacked" +DIGEST = "digest" +WALK = "walk" +DIE = "die" +CRY = "cry" +FREEZE = "freeze" +SLEEP = "sleep" # 关卡状态 -CHOOSE = 'choose' -PLAY = 'play' +CHOOSE = "choose" +PLAY = "play" -# 记录本地存储文件需要记录哪些内容 -USERDATA_KEYS = { LEVEL_NUM, LITTLEGAME_NUM, - LEVEL_COMPLETIONS, - LITTLEGAME_COMPLETIONS, - } +# 加载矩形碰撞范围 用于消除文件边框影响 +# 植物 +PLANT_RECT = { + BULLET_PEA: {"x":28, "y":0, "width":28, "height":34}, + BULLET_PEA_ICE: {"x":26, "y":0, "width":30, "height":34}, + CHOMPER: {"x":0, "y":0, "width":100, "height":114}, + PUFFSHROOM: {"x":0, "y":28, "width":35, "height":38}, + f"{PUFFSHROOM}Sleep": {"x":1, "y":0, "width":39, "height":65}, + BULLET_MUSHROOM: {"x":0, "y":1, "width":55, "height":21}, + BULLET_SEASHROOM: {"x":0, "y":1, "width":55, "height":21}, + POTATOMINE: {"x":0, "y":0, "width":75, "height":55}, + SQUASH: {"x":10, "y":140, "width":80, "height":86}, + f"{SQUASH}Aim": {"x":10, "y":140, "width":80, "height":86}, + SPIKEWEED: {"x":3, "y":0, "width":80, "height":35} +} +# 僵尸 +ZOMBIE_RECT = { + NORMAL_ZOMBIE: {"x":62, "width":90}, + f"{NORMAL_ZOMBIE}Attack": {"x":62, "width":90}, + f"{NORMAL_ZOMBIE}LostHead": {"x":62, "width":90}, + f"{NORMAL_ZOMBIE}LostHeadAttack":{"x":62, "width":90}, + f"{NORMAL_ZOMBIE}Die": {"x":0, "width":164}, + BOOMDIE: {"x":68, "width":80}, + CONEHEAD_ZOMBIE: {"x":80, "width":80}, + f"{CONEHEAD_ZOMBIE}Attack": {"x":79, "width":87}, + BUCKETHEAD_ZOMBIE: {"x":54, "width":90}, + f"{BUCKETHEAD_ZOMBIE}Attack": {"x":46, "width":90}, + FLAG_ZOMBIE: {"x":56, "width":110}, + f"{FLAG_ZOMBIE}Attack": {"x":60, "width":100}, + f"{FLAG_ZOMBIE}LostHead": {"x":55, "width":110}, + f"{FLAG_ZOMBIE}LostHeadAttack": {"x":55, "width":110}, + NEWSPAPER_ZOMBIE: {"x":48, "width":92}, + f"{NEWSPAPER_ZOMBIE}Attack": {"x":48, "width":92}, + f"{NEWSPAPER_ZOMBIE}NoPaper": {"x":40, "width":98}, + f"{NEWSPAPER_ZOMBIE}NoPaperAttack":{"x":48, "width":92}, + f"{NEWSPAPER_ZOMBIE}LostHead": {"x":44, "width":96}, + f"{NEWSPAPER_ZOMBIE}LostHeadAttack":{"x":48, "width":92}, + f"{NEWSPAPER_ZOMBIE}Die": {"x":0, "width":100}, + f"{DUCKY_TUBE_ZOMBIE}Die": {"x":55, "width":105}, + f"{DUCKY_TUBE_ZOMBIE}LostHead": {"x":55, "width":105}, + SCREEN_DOOR_ZOMBIE: {"x":41, "width":100}, + f"{SCREEN_DOOR_ZOMBIE}Attack": {"x":41, "width":100}, +} # 这里还有懒得写代码的补加,用循环实现 +for _part1 in (DUCKY_TUBE_ZOMBIE, CONEHEAD_DUCKY_TUBE_ZOMBIE, BUCKETHEAD_DUCKY_TUBE_ZOMBIE): + for _part2 in ("", "Attack", "Swim"): + ZOMBIE_RECT[f"{_part1}{_part2}"] = {"x":55, "width":105} + + +# 音效 +def _getSound(filename): + return pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,"resources", "sound", filename)) +# 所有音效的元组,用一波海象算子表达(>= python 3.8),免得要维护两个 +SOUNDS = ( # 程序交互等 + SOUND_TAPPING_CARD := _getSound("tap.ogg"), + # 植物 + SOUND_FIREPEA_EXPLODE := _getSound("firepea.ogg"), + SOUND_BULLET_EXPLODE := _getSound("bulletExplode.ogg"), + SOUND_SHOOT := _getSound("shoot.ogg"), + SOUND_SNOWPEA_SPARKLES := _getSound("snowPeaSparkles.ogg"), + SOUND_BOMB := _getSound("bomb.ogg"), + SOUND_BIGCHOMP := _getSound("bigchomp.ogg"), + SOUND_PUFF := _getSound("puff.ogg"), + SOUND_POTATOMINE := _getSound("potatomine.ogg"), + SOUND_SQUASHING := _getSound("squashing.ogg"), + SOUND_SQUASH_HMM := _getSound("squashHmm.ogg"), + SOUND_PLANT_GROW := _getSound("plantGrow.ogg"), + SOUND_MUSHROOM_WAKEUP := _getSound("mushroomWakeup.ogg"), + SOUND_TANGLE_KELP_DRAG := _getSound("tangleKelpDrag.ogg"), + SOUND_DOOMSHROOM := _getSound("doomshroom.ogg"), + SOUND_GRAVEBUSTER_CHOMP := _getSound("gravebusterchomp.ogg"), + SOUND_FUME := _getSound("fume.ogg"), + # 僵尸 + SOUND_ZOMBIE_ENTERING_WATER := _getSound("zombieEnteringWater.ogg"), + SOUND_ZOMBIE_ATTACKING := _getSound("zombieAttack.ogg"), + SOUND_FREEZE := _getSound("freeze.ogg"), + SOUND_HYPNOED := _getSound("hypnoed.ogg"), + SOUND_NEWSPAPER_RIP := _getSound("newspaperRip.ogg"), + SOUND_NEWSPAPER_ZOMBIE_ANGRY := _getSound("newspaperZombieAngry.ogg"), + SOUND_POLEVAULT_JUMP := _getSound("polevaultjump.ogg"), + SOUND_ZOMBONI := _getSound("zomboni.ogg"), + SOUND_ZOMBONI_EXPLOSION := _getSound("zomboniExplosion.ogg"), + # 关卡中 + SOUND_CAR_WALKING := _getSound("carWalking.ogg"), + SOUND_ZOMBIE_COMING := _getSound("zombieComing.ogg"), + SOUND_ZOMBIE_VOICE := _getSound("zombieVoice.ogg"), + SOUND_HUGE_WAVE_APPROCHING := _getSound("hugeWaveApproching.ogg"), + SOUND_BUTTON_CLICK := _getSound("buttonclick.ogg"), + SOUND_COLLECT_SUN := _getSound("collectSun.ogg"), + SOUND_CLICK_CARD := _getSound("clickCard.ogg"), + SOUND_SHOVEL := _getSound("shovel.ogg"), + SOUND_PLANT := _getSound("plant.ogg"), + SOUND_BOWLING_IMPACT := _getSound("bowlingimpact.ogg"), + SOUND_PLANT_DIE := _getSound("plantDie.ogg"), + SOUND_EVILLAUGH := _getSound("evillaugh.ogg"), + SOUND_LOSE := _getSound("lose.ogg"), + SOUND_WIN := _getSound("win.ogg"), + SOUND_SCREAM := _getSound("scream.ogg"), + SOUND_CANNOT_CHOOSE_WARNING := _getSound("cannotChooseWarning.ogg"), + SOUND_FINAL_FANFARE := _getSound("finalfanfare.ogg"), + ) + +# 记录本地存储文件初始值 +INIT_USERDATA = { + LEVEL_NUM: 1, + LITTLEGAME_NUM: 1, + LEVEL_COMPLETIONS: 0, + LITTLEGAME_COMPLETIONS: 0, + GAME_RATE: 1, + SOUND_VOLUME: 1, + } # 无穷大常量 -INF = float("inf") # python传递字符串性能较低,故在这里对inf声明一次,以后仅需调用即可 +INF = float("inf") # python传递字符串性能较低,故在这里对inf声明一次,以后仅需调用即可,虽然真正的用处是可以自动补全( diff --git a/source/state/level.py b/source/state/level.py index bc0e406..61c7833 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1,11 +1,11 @@ import os -import json -import sys import pygame as pg import random +import logging from .. import tool from .. import constants as c from ..component import map, plant, zombie, menubar +logger = logging.getLogger("main") class Level(tool.State): def __init__(self): @@ -24,13 +24,6 @@ class Level(tool.State): self.showLittleMenu = False # 导入地图参数 - # 这些注释内容是将来增加通过界面后的容错设计,以保证直接通关时不会闪退 - # 现在为了明确一开始就没有正确导入地图的错误,没有启用这些设定 - # if self.loadMap(): # 表示导入成功 - # self.map = map.Map(self.map_data[c.BACKGROUND_TYPE]) - # self.map_y_len = self.map.height - # self.setupBackground() - # self.initState() self.loadMap() self.map = map.Map(self.map_data[c.BACKGROUND_TYPE]) self.map_y_len = self.map.height @@ -38,60 +31,48 @@ class Level(tool.State): self.initState() def loadMap(self): - if self.game_info[c.GAME_MODE] == c.MODE_LITTLEGAME: - map_file = f'littleGame_{self.game_info[c.LITTLEGAME_NUM]}.json' - elif self.game_info[c.GAME_MODE] == c.MODE_ADVENTURE: - map_file = f'level_{self.game_info[c.LEVEL_NUM]}.json' - file_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),'resources' , 'data', 'map', map_file) - # 最后一关之后应该结束了 - try: - with open(file_path) as f: - self.map_data = json.load(f) - except FileNotFoundError: - print("成功通关!") - if self.game_info[c.GAME_MODE] == c.MODE_LITTLEGAME: - self.game_info[c.LEVEL_NUM] = c.START_LEVEL_NUM - self.game_info[c.LEVEL_COMPLETIONS] += 1 - elif self.game_info[c.GAME_MODE] == c.MODE_LITTLEGAME: - self.game_info[c.LITTLEGAME_NUM] = c.START_LITTLE_GAME_NUM - self.game_info[c.LITTLEGAME_COMPLETIONS] += 1 - 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.opus")) - pg.mixer.music.play(-1, 0) - with open(c.USERDATA_PATH, "w") as f: - userdata = {} - for i in self.game_info: - if i in c.USERDATA_KEYS: - userdata[i] = self.game_info[i] - savedata = json.dumps(userdata, sort_keys=True, indent=4) - f.write(savedata) - return + # 冒险模式 + if self.game_info[c.GAME_MODE] == c.MODE_ADVENTURE: + if 0 <= self.game_info[c.LEVEL_NUM] < map.TOTAL_LEVEL: + self.map_data = map.LEVEL_MAP_DATA[self.game_info[c.LEVEL_NUM]] + else: + self.game_info[c.LEVEL_NUM] = 1 + self.saveUserData() + self.map_data = map.LEVEL_MAP_DATA[self.game_info[c.LEVEL_NUM]] + logger.warning("关卡数设定错误!进入默认的第一关!") + # 小游戏模式 + elif self.game_info[c.GAME_MODE] == c.MODE_LITTLEGAME: + if 0 <= self.game_info[c.LITTLEGAME_NUM] < map.TOTAL_LITTLE_GAME: + self.map_data = map.LITTLE_GAME_MAP_DATA[self.game_info[c.LITTLEGAME_NUM]] + else: + self.game_info[c.LITTLEGAME_NUM] = 1 + self.saveUserData() + self.map_data = map.LITTLE_GAME_MAP_DATA[self.game_info[c.LITTLEGAME_NUM]] + logger.warning("关卡数设定错误!进入默认的第一关!") # 是否有铲子的信息:无铲子时为0,有铲子时为1,故直接赋值即可 self.hasShovel = self.map_data[c.SHOVEL] # 同时指定音乐 # 缺省音乐为进入的音乐,方便发现错误 - self.bgm = 'intro.opus' + self.bgm = "intro.opus" if c.CHOOSEBAR_TYPE in self.map_data: # 指定了choosebar_type的传送带关 - if self.map_data[c.CHOOSEBAR_TYPE] == c.CHOSSEBAR_BOWLING: # 坚果保龄球 - self.bgm = 'bowling.opus' + if self.map_data[c.CHOOSEBAR_TYPE] == c.CHOOSEBAR_BOWLING: # 坚果保龄球 + self.bgm = "bowling.opus" elif self.map_data[c.CHOOSEBAR_TYPE] == c.CHOOSEBAR_MOVE: # 传送带 - self.bgm = 'battle.opus' + self.bgm = "battle.opus" else: # 一般选卡关,非传送带 # 白天类 if self.map_data[c.BACKGROUND_TYPE] in c.BACKGROUND_DAY_LIKE_BACKGROUNDS: - self.bgm = 'dayLevel.opus' + self.bgm = "dayLevel.opus" # 夜晚 elif self.map_data[c.BACKGROUND_TYPE] == c.BACKGROUND_NIGHT: - self.bgm = 'nightLevel.opus' + self.bgm = "nightLevel.opus" # 泳池 elif self.map_data[c.BACKGROUND_TYPE] == c.BACKGROUND_POOL: - self.bgm = 'poolLevel.opus' + self.bgm = "poolLevel.opus" # 浓雾 elif self.map_data[c.BACKGROUND_TYPE] == c.BACKGROUND_FOG: - self.bgm = 'fogLevel.opus' + self.bgm = "fogLevel.opus" def setupBackground(self): img_index = self.map_data[c.BACKGROUND_TYPE] @@ -147,12 +128,12 @@ class Level(tool.State): if (self.bar_type != c.CHOOSEBAR_STATIC): volume += 2 - if inevitableZombieDict and (str(wave) in inevitableZombieDict): + if inevitableZombieDict and (wave in inevitableZombieDict): for newZombie in inevitableZombieDict[str(wave)]: zombieList.append(newZombie) volume -= c.CREATE_ZOMBIE_DICT[newZombie][0] if volume < 0: - print('警告:第{}波中手动设置的僵尸级别总数超过上限!'.format(wave)) + logger.warning(f"第{wave}波中手动设置的僵尸级别总数超过上限!") # 防止因为僵尸最小等级过大,使得总容量无法完全利用,造成死循环的检查机制 minCost = c.CREATE_ZOMBIE_DICT[min(useableZombies, key=lambda x:c.CREATE_ZOMBIE_DICT[x][0])][0] @@ -273,14 +254,14 @@ class Level(tool.State): self.waveTime = current_time self.waveZombies = self.waves[self.waveNum - 1] self.numZombie = len(self.waveZombies) - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zombieComing.ogg")).play() + c.SOUND_ZOMBIE_COMING.play() else: if (current_time - self.waveTime >= 6000): self.waveNum += 1 self.waveTime = current_time self.waveZombies = self.waves[self.waveNum - 1] self.numZombie = len(self.waveZombies) - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zombieComing.ogg")).play() + c.SOUND_ZOMBIE_COMING.play() return if (self.waveNum % 10 != 9): if ((current_time - self.waveTime >= 25000 + random.randint(0, 6000)) or (self.bar_type != c.CHOOSEBAR_STATIC and current_time - self.waveTime >= 12500 + random.randint(0, 3000))): @@ -288,7 +269,7 @@ class Level(tool.State): self.waveTime = current_time self.waveZombies = self.waves[self.waveNum - 1] self.numZombie = len(self.waveZombies) - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "zombieVoice.ogg")).play() + c.SOUND_ZOMBIE_VOICE.play() else: if ((current_time - self.waveTime >= 45000) or (self.bar_type != c.CHOOSEBAR_STATIC and current_time - self.waveTime >= 25000)): self.waveNum += 1 @@ -296,7 +277,7 @@ class Level(tool.State): self.waveZombies = self.waves[self.waveNum - 1] self.numZombie = len(self.waveZombies) # 一大波时播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "hugeWaveApproching.ogg")).play() + c.SOUND_HUGE_WAVE_APPROCHING.play() return elif ((current_time - self.waveTime >= 43000) or (self.bar_type != c.CHOOSEBAR_STATIC and current_time - self.waveTime >= 23000)): self.showHugeWaveApprochingTime = current_time @@ -321,10 +302,7 @@ class Level(tool.State): self.zombie_list = [] for data in self.map_data[c.ZOMBIE_LIST]: - if 'map_y' in data: - self.zombie_list.append((data['time'], data['name'], data['map_y'])) - else: - self.zombie_list.append((data['time'], data['name'])) + self.zombie_list.append((data["time"], data["name"], data["map_y"])) self.zombie_start_time = 0 self.zombie_list.sort(key=takeTime) @@ -336,9 +314,6 @@ class Level(tool.State): # 更新函数每帧被调用,将鼠标事件传入给状态处理函数 def update(self, surface, current_time, mouse_pos, mouse_click): - # 这些注释内容是将来增加通过界面后的容错设计,以保证直接通关时不会闪退 - # if self.done: - # return self.current_time = self.game_info[c.CURRENT_TIME] = self.pvzTime(current_time) if self.state == c.CHOOSE: self.choose(mouse_pos, mouse_click) @@ -371,7 +346,7 @@ class Level(tool.State): else: card_pool = menubar.getCardPool(self.map_data[c.CARD_POOL]) self.initPlay(card_pool) - if self.bar_type == c.CHOSSEBAR_BOWLING: + if self.bar_type == c.CHOOSEBAR_BOWLING: self.initBowlingMap() self.setupLittleMenu() @@ -382,8 +357,9 @@ class Level(tool.State): # 播放选卡音乐 pg.mixer.music.stop() - pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", "chooseYourSeeds.opus")) + pg.mixer.music.load(os.path.join(c.PATH_MUSIC_DIR, "chooseYourSeeds.opus")) pg.mixer.music.play(-1, 0) + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) def choose(self, mouse_pos, mouse_click): # 如果暂停 @@ -395,16 +371,17 @@ class Level(tool.State): self.panel.checkCardClick(mouse_pos) if self.panel.checkStartButtonClick(mouse_pos): self.initPlay(self.panel.getSelectedCards()) - elif self.checkLittleMenuClick(mouse_pos): + elif self.inArea(self.little_menu_rect, *mouse_pos): self.showLittleMenu = True - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "buttonclick.ogg")).play() + c.SOUND_BUTTON_CLICK.play() def initPlay(self, card_list): # 播放bgm pg.mixer.music.stop() - pg.mixer.music.load(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "music", self.bgm)) + pg.mixer.music.load(os.path.join(c.PATH_MUSIC_DIR, self.bgm)) pg.mixer.music.play(-1, 0) + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) self.state = c.PLAY if self.bar_type == c.CHOOSEBAR_STATIC: @@ -504,58 +481,115 @@ class Level(tool.State): self.little_menu_rect.x = 690 self.little_menu_rect.y = 0 + # 弹出的菜单框 frame_rect = (0, 0, 500, 500) self.big_menu = tool.get_image_menu(tool.GFX[c.BIG_MENU], *frame_rect, c.BLACK, 1.1) self.big_menu_rect = self.big_menu.get_rect() self.big_menu_rect.x = 150 self.big_menu_rect.y = 0 - frame_rect = (0, 0, 342, 87) - self.return_button = tool.get_image_menu(tool.GFX[c.RETURN_BUTTON], *frame_rect, c.BLACK, 1.1) + # 返回按钮,用字体渲染实现,增强灵活性 + # 建立一个按钮大小的surface对象 + self.return_button = pg.Surface((376, 96)) + self.return_button.set_colorkey(c.BLACK) # 避免多余区域显示成黑色 self.return_button_rect = self.return_button.get_rect() self.return_button_rect.x = 220 self.return_button_rect.y = 440 + font = pg.font.Font(c.FONT_PATH, 40) + font.bold = True + text = font.render("返回游戏", True, c.YELLOWGREEN) + text_rect = text.get_rect() + text_rect.x = 105 + text_rect.y = 18 + self.return_button.blit(text, text_rect) + # 重新开始按钮 frame_rect = (0, 0, 207, 45) self.restart_button = tool.get_image_menu(tool.GFX[c.RESTART_BUTTON], *frame_rect, c.BLACK, 1.1) self.restart_button_rect = self.restart_button.get_rect() self.restart_button_rect.x = 295 self.restart_button_rect.y = 325 + # 主菜单按钮 frame_rect = (0, 0, 206, 43) self.mainMenu_button = tool.get_image_menu(tool.GFX[c.MAINMENU_BUTTON], *frame_rect, c.BLACK, 1.1) self.mainMenu_button_rect = self.mainMenu_button.get_rect() self.mainMenu_button_rect.x = 299 self.mainMenu_button_rect.y = 372 + # 音量+、音量- + frame_rect = (0, 0, 39, 41) + font = pg.font.Font(c.FONT_PATH, 35) + font.bold = True + # 音量+ + self.sound_volume_plus_button = tool.get_image_menu(tool.GFX[c.SOUND_VOLUME_BUTTON], *frame_rect, c.BLACK) + sign = font.render("+", True, c.YELLOWGREEN) + sign_rect = sign.get_rect() + sign_rect.x = 8 + sign_rect.y = -4 + self.sound_volume_plus_button.blit(sign, sign_rect) + self.sound_volume_plus_button_rect = self.sound_volume_plus_button.get_rect() + self.sound_volume_plus_button_rect.x = 500 + # 音量- + self.sound_volume_minus_button = tool.get_image_menu(tool.GFX[c.SOUND_VOLUME_BUTTON], *frame_rect, c.BLACK) + sign = font.render("-", True, c.YELLOWGREEN) + sign_rect = sign.get_rect() + sign_rect.x = 12 + sign_rect.y = -8 + self.sound_volume_minus_button.blit(sign, sign_rect) + self.sound_volume_minus_button_rect = self.sound_volume_minus_button.get_rect() + self.sound_volume_minus_button_rect.x = 450 + # 音量+、-应当处于同一高度 + self.sound_volume_minus_button_rect.y = self.sound_volume_plus_button_rect.y = 250 + def pauseAndCheckLittleMenuOptions(self, mouse_pos, mouse_click): # 设置暂停状态 self.pause = True # 暂停播放音乐 pg.mixer.music.pause() if mouse_click[0]: - if self.checkReturnClick(mouse_pos): + # 返回键 + if self.inArea(self.return_button_rect, *mouse_pos): # 终止暂停,停止显示菜单 self.pause = False self.showLittleMenu = False # 继续播放音乐 pg.mixer.music.unpause() # 播放点击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "buttonclick.ogg")).play() - elif self.checkRestartClick(mouse_pos): + c.SOUND_BUTTON_CLICK.play() + # 重新开始键 + elif self.inArea(self.restart_button_rect, *mouse_pos): self.done = True self.next = c.LEVEL # 播放点击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "buttonclick.ogg")).play() - elif self.checkMainMenuClick(mouse_pos): + c.SOUND_BUTTON_CLICK.play() + # 主菜单键 + elif self.inArea(self.mainMenu_button_rect, *mouse_pos): self.done = True self.next = c.MAIN_MENU - self.persist = {c.CURRENT_TIME:0, c.LEVEL_NUM:self.persist[c.LEVEL_NUM], c.LITTLEGAME_NUM:self.persist[c.LITTLEGAME_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.opus")) - pg.mixer.music.play(-1, 0) + self.persist = self.game_info + self.persist[c.CURRENT_TIME] = 0 # 播放点击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "buttonclick.ogg")).play() + c.SOUND_BUTTON_CLICK.play() + # 音量+ + elif self.inArea(self.sound_volume_plus_button_rect, *mouse_pos): + self.game_info[c.SOUND_VOLUME] = round(min(self.game_info[c.SOUND_VOLUME] + 0.05, 1), 2) + # 一般不会有人想把音乐和音效分开设置,故pg.mixer.Sound.set_volume()和pg.mixer.music.set_volume()需要一起用 + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) + for i in c.SOUNDS: + i.set_volume(self.game_info[c.SOUND_VOLUME]) + c.SOUND_BUTTON_CLICK.play() + # 将音量信息存档 + self.saveUserData() + elif self.inArea(self.sound_volume_minus_button_rect, *mouse_pos): + self.game_info[c.SOUND_VOLUME] = round(max(self.game_info[c.SOUND_VOLUME] - 0.05, 0), 2) + # 一般不会有人想把音乐和音效分开设置,故pg.mixer.Sound.set_volume()和pg.mixer.music.set_volume()需要一起用 + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) + for i in c.SOUNDS: + i.set_volume(self.game_info[c.SOUND_VOLUME]) + c.SOUND_BUTTON_CLICK.play() + # 将音量信息存档 + self.saveUserData() # 一大波僵尸来袭图片显示 @@ -574,54 +608,22 @@ class Level(tool.State): frame_rect = (0, 0, 158, 26) self.level_progress_bar_image = tool.get_image_menu(tool.GFX[c.LEVEL_PROGRESS_BAR], *frame_rect, c.BLACK, 1) self.level_progress_bar_image_rect = self.level_progress_bar_image.get_rect() - self.level_progress_bar_image_rect.x = 600 # 猜的 - self.level_progress_bar_image_rect.y = 565 # 猜的 + self.level_progress_bar_image_rect.x = 600 + self.level_progress_bar_image_rect.y = 574 # 僵尸头 frame_rect = (0, 0, 23, 25) self.level_progress_zombie_head_image = tool.get_image_menu(tool.GFX[c.LEVEL_PROGRESS_ZOMBIE_HEAD], *frame_rect, c.BLACK, 1) self.level_progress_zombie_head_image_rect = self.level_progress_zombie_head_image.get_rect() - self.level_progress_zombie_head_image_rect.x = self.level_progress_bar_image_rect.x + 75 # 猜的 - self.level_progress_zombie_head_image_rect.y = self.level_progress_bar_image_rect.y - 3 # 猜的 + self.level_progress_zombie_head_image_rect.x = self.level_progress_bar_image_rect.x + 75 + self.level_progress_zombie_head_image_rect.y = self.level_progress_bar_image_rect.y - 3 # 旗帜(这里只包括最后一面) frame_rect = (0, 0, 20, 18) self.level_progress_flag = tool.get_image_menu(tool.GFX[c.LEVEL_PROGRESS_FLAG], *frame_rect, c.BLACK, 1) self.level_progress_flag_rect = self.level_progress_flag.get_rect() - self.level_progress_flag_rect.x = self.level_progress_bar_image_rect.x - 78 # 猜的 - self.level_progress_flag_rect.y = self.level_progress_bar_image_rect.y - 3 # 猜的 - - # 检查小菜单有没有被点击 - def checkLittleMenuClick(self, mouse_pos): - x, y = mouse_pos - if (x >= self.little_menu_rect.x and x <= self.little_menu_rect.right and - y >= self.little_menu_rect.y and y <= self.little_menu_rect.bottom): - return True - return False - - # 检查小菜单的返回有没有被点击 - def checkReturnClick(self, mouse_pos): - x, y = mouse_pos - if (x >= self.return_button_rect.x and x <= self.return_button_rect.right and - y >= self.return_button_rect.y and y <= self.return_button_rect.bottom): - return True - return False - - # 检查小菜单的重新开始有没有被点击 - def checkRestartClick(self, mouse_pos): - x, y = mouse_pos - if (x >= self.restart_button_rect.x and x <= self.restart_button_rect.right and - y >= self.restart_button_rect.y and y <= self.restart_button_rect.bottom): - return True - return False - - # 检查小菜单的主菜单有没有被点击 - def checkMainMenuClick(self, mouse_pos): - x, y = mouse_pos - if (x >= self.mainMenu_button_rect.x and x <= self.mainMenu_button_rect.right and - y >= self.mainMenu_button_rect.y and y <= self.mainMenu_button_rect.bottom): - return True - return False + self.level_progress_flag_rect.x = self.level_progress_bar_image_rect.x - 78 + self.level_progress_flag_rect.y = self.level_progress_bar_image_rect.y - 3 # 用小铲子移除植物 def shovelRemovePlant(self, mouse_pos): @@ -640,8 +642,8 @@ class Level(tool.State): if c.LILYPAD in self.map.map[map_y][map_x][c.MAP_PLANT]: if i.name == c.LILYPAD: continue - elif '花盆(未实现)' in self.map.map[map_y][map_x][c.MAP_PLANT]: - if i.name == '花盆(未实现)': + elif "花盆(未实现)" in self.map.map[map_y][map_x][c.MAP_PLANT]: + if i.name == "花盆(未实现)": continue self.killPlant(i, shovel=True) # 使用后默认铲子复原 @@ -649,16 +651,6 @@ class Level(tool.State): self.removeMouseImagePlus() return - # 检查小铲子的位置有没有被点击 - # 方便放回去 - def checkShovelClick(self, mouse_pos): - x, y = mouse_pos - if( self.hasShovel and - x >= self.shovel_box_rect.x and x <= self.shovel_box_rect.right and - y >= self.shovel_box_rect.y and y <= self.shovel_box_rect.bottom): - return True - return False - def play(self, mouse_pos, mouse_click): # 原版阳光掉落机制需要 # 已掉落的阳光 @@ -677,12 +669,8 @@ class Level(tool.State): data = self.zombie_list[0] # 因此要求僵尸列表按照时间顺序排列 # data内容排列:[0]:时间 [1]:名称 [2]:坐标 if data[0] <= (self.current_time - self.zombie_start_time): - if len(data) == 3: - self.createZombie(data[1], data[2]) - self.zombie_list.remove(data) - else: # len(data) == 2 没有指定map_y - self.createZombie(data[1]) - self.zombie_list.remove(data) + self.createZombie(data[1], data[2]) + self.zombie_list.remove(data) else: # 新僵尸生成方式 self.refreshWaves(self.current_time) @@ -724,7 +712,7 @@ class Level(tool.State): self.menubar.increaseSunValue(sun.sun_value) clickedSun = True # 播放收集阳光的音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "collectSun.ogg")).play() + c.SOUND_COLLECT_SUN.play() # 拖动植物或者铲子 if not self.drag_plant and mouse_pos and mouse_click[0] and not clickedSun: @@ -734,7 +722,7 @@ class Level(tool.State): self.clickResult[1].clicked = True clickedCardsOrMap = True # 播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "clickCard.ogg")).play() + c.SOUND_CLICK_CARD.play() elif self.drag_plant: if mouse_click[1]: self.removeMouseImage() @@ -754,20 +742,21 @@ class Level(tool.State): # 检查是否点击菜单 if mouse_click[0] and (not clickedSun) and (not clickedCardsOrMap): - if self.checkLittleMenuClick(mouse_pos): + if self.inArea(self.little_menu_rect, *mouse_pos): # 暂停 显示菜单 self.showLittleMenu = True # 播放点击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "buttonclick.ogg")).play() - elif self.checkShovelClick(mouse_pos): - self.drag_shovel = not self.drag_shovel - if not self.drag_shovel: - self.removeMouseImagePlus() - # 播放点击铲子的音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "shovel.ogg")).play() - elif self.drag_shovel: - # 移出这地方的植物 - self.shovelRemovePlant(mouse_pos) + c.SOUND_BUTTON_CLICK.play() + elif self.hasShovel: + if self.inArea(self.shovel_box_rect, *mouse_pos): + self.drag_shovel = not self.drag_shovel + if not self.drag_shovel: + self.removeMouseImagePlus() + # 播放点击铲子的音效 + c.SOUND_SHOVEL.play() + elif self.drag_shovel: + # 移出这地方的植物 + self.shovelRemovePlant(mouse_pos) for car in self.cars: if car: @@ -793,7 +782,7 @@ class Level(tool.State): if self.map_data[c.BACKGROUND_TYPE] in c.POOL_EQUIPPED_BACKGROUNDS: if name in c.WATER_ZOMBIE: map_y = random.randint(2, 3) - elif name == '这里应该换成气球僵尸的名字(最好写调用的变量名,最好不要直接写,保持风格统一)': + elif name == "这里应该换成气球僵尸的名字(最好写调用的变量名,最好不要直接写,保持风格统一)": map_y = random.randint(0, 5) else: # 陆生僵尸 map_y = random.randint(0, 3) @@ -817,35 +806,35 @@ class Level(tool.State): x, y = self.map.getMapGridPos(0, map_y) # 新增的僵尸也需要在这里声明 - match name: - case c.NORMAL_ZOMBIE: - self.zombie_groups[map_y].add(zombie.NormalZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.CONEHEAD_ZOMBIE: - self.zombie_groups[map_y].add(zombie.ConeHeadZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.BUCKETHEAD_ZOMBIE: - self.zombie_groups[map_y].add(zombie.BucketHeadZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.FLAG_ZOMBIE: - self.zombie_groups[map_y].add(zombie.FlagZombie(c.ZOMBIE_START_X, y, self.head_group)) - case c.NEWSPAPER_ZOMBIE: - self.zombie_groups[map_y].add(zombie.NewspaperZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.FOOTBALL_ZOMBIE: - self.zombie_groups[map_y].add(zombie.FootballZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.DUCKY_TUBE_ZOMBIE: - self.zombie_groups[map_y].add(zombie.DuckyTubeZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.CONEHEAD_DUCKY_TUBE_ZOMBIE: - self.zombie_groups[map_y].add(zombie.ConeHeadDuckyTubeZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.BUCKETHEAD_DUCKY_TUBE_ZOMBIE: - self.zombie_groups[map_y].add(zombie.BucketHeadDuckyTubeZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.SCREEN_DOOR_ZOMBIE: - self.zombie_groups[map_y].add(zombie.ScreenDoorZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) - case c.POLE_VAULTING_ZOMBIE: - # 本来撑杆跳生成位置不同,对齐左端可认为修正了一部分(看作移动了70),只需要相对修改即可 - self.zombie_groups[map_y].add(zombie.PoleVaultingZombie(c.ZOMBIE_START_X + random.randint(0, 10) + hugeWaveMove, y, self.head_group)) - case c.ZOMBONI: - # 冰车僵尸生成位置不同 - self.zombie_groups[map_y].add(zombie.Zomboni(c.ZOMBIE_START_X + random.randint(0, 10) + hugeWaveMove, y, self.plant_groups[map_y], self.map, plant.IceFrozenPlot)) - case c.SNORKELZOMBIE: - self.zombie_groups[map_y].add(zombie.SnorkelZombie(c.ZOMBIE_START_X + random.randint(0, 10) + hugeWaveMove, y, self.head_group)) + if name == c.NORMAL_ZOMBIE: + self.zombie_groups[map_y].add(zombie.NormalZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.CONEHEAD_ZOMBIE: + self.zombie_groups[map_y].add(zombie.ConeHeadZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.BUCKETHEAD_ZOMBIE: + self.zombie_groups[map_y].add(zombie.BucketHeadZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.FLAG_ZOMBIE: + self.zombie_groups[map_y].add(zombie.FlagZombie(c.ZOMBIE_START_X, y, self.head_group)) + elif name == c.NEWSPAPER_ZOMBIE: + self.zombie_groups[map_y].add(zombie.NewspaperZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.FOOTBALL_ZOMBIE: + self.zombie_groups[map_y].add(zombie.FootballZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.DUCKY_TUBE_ZOMBIE: + self.zombie_groups[map_y].add(zombie.DuckyTubeZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.CONEHEAD_DUCKY_TUBE_ZOMBIE: + self.zombie_groups[map_y].add(zombie.ConeHeadDuckyTubeZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.BUCKETHEAD_DUCKY_TUBE_ZOMBIE: + self.zombie_groups[map_y].add(zombie.BucketHeadDuckyTubeZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.SCREEN_DOOR_ZOMBIE: + self.zombie_groups[map_y].add(zombie.ScreenDoorZombie(c.ZOMBIE_START_X + random.randint(-20, 20) + hugeWaveMove, y, self.head_group)) + elif name == c.POLE_VAULTING_ZOMBIE: + # 本来撑杆跳生成位置不同,对齐左端可认为修正了一部分(看作移动了70),只需要相对修改即可 + self.zombie_groups[map_y].add(zombie.PoleVaultingZombie(c.ZOMBIE_START_X + random.randint(0, 10) + hugeWaveMove, y, self.head_group)) + elif name == c.ZOMBONI: + # 冰车僵尸生成位置不同 + self.zombie_groups[map_y].add(zombie.Zomboni(c.ZOMBIE_START_X + random.randint(0, 10) + hugeWaveMove, y, self.plant_groups[map_y], self.map, plant.IceFrozenPlot)) + elif name == c.SNORKELZOMBIE: + # 潜水僵尸生成位置不同 + self.zombie_groups[map_y].add(zombie.SnorkelZombie(c.ZOMBIE_START_X + random.randint(0, 10) + hugeWaveMove, y, self.head_group)) # 能否种植物的判断: # 先判断位置是否合法 isValid(map_x, map_y) @@ -869,71 +858,71 @@ class Level(tool.State): map_x, map_y = self.map.getMapIndex(x, y) # 新植物也需要在这里声明 - match self.plant_name: - case c.SUNFLOWER: - new_plant = plant.SunFlower(x, y, self.sun_group) - case c.PEASHOOTER: - new_plant = plant.PeaShooter(x, y, self.bullet_groups[map_y]) - case c.SNOWPEASHOOTER: - new_plant = plant.SnowPeaShooter(x, y, self.bullet_groups[map_y]) - case c.WALLNUT: - new_plant = plant.WallNut(x, y) - case c.CHERRYBOMB: - new_plant = plant.CherryBomb(x, y) - case c.THREEPEASHOOTER: - new_plant = plant.ThreePeaShooter(x, y, self.bullet_groups, map_y, self.map.background_type) - case c.REPEATERPEA: - new_plant = plant.RepeaterPea(x, y, self.bullet_groups[map_y]) - case c.CHOMPER: - new_plant = plant.Chomper(x, y) - case c.PUFFSHROOM: - new_plant = plant.PuffShroom(x, y, self.bullet_groups[map_y]) - case c.POTATOMINE: - new_plant = plant.PotatoMine(x, y) - case c.SQUASH: - new_plant = plant.Squash(x, y, self.map.map[map_y][map_x][c.MAP_PLANT]) - case c.SPIKEWEED: - new_plant = plant.Spikeweed(x, y) - case c.JALAPENO: - new_plant = plant.Jalapeno(x, y) - case c.SCAREDYSHROOM: - new_plant = plant.ScaredyShroom(x, y, self.bullet_groups[map_y]) - case c.SUNSHROOM: - new_plant = plant.SunShroom(x, y, self.sun_group) - case c.ICESHROOM: - new_plant = plant.IceShroom(x, y) - case c.HYPNOSHROOM: - new_plant = plant.HypnoShroom(x, y) - case c.WALLNUTBOWLING: - new_plant = plant.WallNutBowling(x, y, map_y, self) - case c.REDWALLNUTBOWLING: - new_plant = plant.RedWallNutBowling(x, y) - case c.LILYPAD: - new_plant = plant.LilyPad(x, y) - case c.TORCHWOOD: - new_plant = plant.TorchWood(x, y, self.bullet_groups[map_y]) - case c.STARFRUIT: - new_plant = plant.StarFruit(x, y, self.bullet_groups[map_y], self) - case c.COFFEEBEAN: - new_plant = plant.CoffeeBean(x, y, self.plant_groups[map_y], self.map.map[map_y][map_x], self.map, map_x) - case c.SEASHROOM: - new_plant = plant.SeaShroom(x, y, self.bullet_groups[map_y]) - case c.TALLNUT: - new_plant = plant.TallNut(x, y) - case c.TANGLEKLEP: - new_plant = plant.TangleKlep(x, y) - case c.DOOMSHROOM: - if self.map.gridHeightSize == c.GRID_Y_SIZE: - new_plant = plant.DoomShroom(x, y, self.map.map[map_y][map_x][c.MAP_PLANT], explode_y_range=2) - else: - new_plant = plant.DoomShroom(x, y, self.map.map[map_y][map_x][c.MAP_PLANT], explode_y_range=3) - case c.GRAVEBUSTER: - new_plant = plant.GraveBuster(x, y, self.plant_groups[map_y], self.map, map_x) - case c.FUMESHROOM: - new_plant = plant.FumeShroom(x, y, self.bullet_groups[map_y], self.zombie_groups[map_y]) - case c.GARLIC: - new_plant = plant.Garlic(x, y) - + if self.plant_name == c.SUNFLOWER: + new_plant = plant.SunFlower(x, y, self.sun_group) + elif self.plant_name == c.PEASHOOTER: + new_plant = plant.PeaShooter(x, y, self.bullet_groups[map_y]) + elif self.plant_name == c.SNOWPEASHOOTER: + new_plant = plant.SnowPeaShooter(x, y, self.bullet_groups[map_y]) + elif self.plant_name == c.WALLNUT: + new_plant = plant.WallNut(x, y) + elif self.plant_name == c.CHERRYBOMB: + new_plant = plant.CherryBomb(x, y) + elif self.plant_name == c.THREEPEASHOOTER: + new_plant = plant.ThreePeaShooter(x, y, self.bullet_groups, map_y, self.map.background_type) + elif self.plant_name == c.REPEATERPEA: + new_plant = plant.RepeaterPea(x, y, self.bullet_groups[map_y]) + elif self.plant_name == c.CHOMPER: + new_plant = plant.Chomper(x, y) + elif self.plant_name == c.PUFFSHROOM: + new_plant = plant.PuffShroom(x, y, self.bullet_groups[map_y]) + elif self.plant_name == c.POTATOMINE: + new_plant = plant.PotatoMine(x, y) + elif self.plant_name == c.SQUASH: + new_plant = plant.Squash(x, y, self.map.map[map_y][map_x][c.MAP_PLANT]) + elif self.plant_name == c.SPIKEWEED: + new_plant = plant.Spikeweed(x, y) + elif self.plant_name == c.JALAPENO: + new_plant = plant.Jalapeno(x, y) + elif self.plant_name == c.SCAREDYSHROOM: + new_plant = plant.ScaredyShroom(x, y, self.bullet_groups[map_y]) + elif self.plant_name == c.SUNSHROOM: + new_plant = plant.SunShroom(x, y, self.sun_group) + elif self.plant_name == c.ICESHROOM: + new_plant = plant.IceShroom(x, y) + elif self.plant_name == c.HYPNOSHROOM: + new_plant = plant.HypnoShroom(x, y) + elif self.plant_name == c.WALLNUTBOWLING: + new_plant = plant.WallNutBowling(x, y, map_y, self) + elif self.plant_name == c.REDWALLNUTBOWLING: + new_plant = plant.RedWallNutBowling(x, y) + elif self.plant_name == c.LILYPAD: + new_plant = plant.LilyPad(x, y) + elif self.plant_name == c.TORCHWOOD: + new_plant = plant.TorchWood(x, y, self.bullet_groups[map_y]) + elif self.plant_name == c.STARFRUIT: + new_plant = plant.StarFruit(x, y, self.bullet_groups[map_y], self) + elif self.plant_name == c.COFFEEBEAN: + new_plant = plant.CoffeeBean(x, y, self.plant_groups[map_y], self.map.map[map_y][map_x], self.map, map_x) + elif self.plant_name == c.SEASHROOM: + new_plant = plant.SeaShroom(x, y, self.bullet_groups[map_y]) + elif self.plant_name == c.TALLNUT: + new_plant = plant.TallNut(x, y) + elif self.plant_name == c.TANGLEKLEP: + new_plant = plant.TangleKlep(x, y) + elif self.plant_name == c.DOOMSHROOM: + if self.map.gridHeightSize == c.GRID_Y_SIZE: + new_plant = plant.DoomShroom(x, y, self.map.map[map_y][map_x][c.MAP_PLANT], explode_y_range=2) + else: + new_plant = plant.DoomShroom(x, y, self.map.map[map_y][map_x][c.MAP_PLANT], explode_y_range=3) + elif self.plant_name == c.GRAVEBUSTER: + new_plant = plant.GraveBuster(x, y, self.plant_groups[map_y], self.map, map_x) + elif self.plant_name == c.FUMESHROOM: + new_plant = plant.FumeShroom(x, y, self.bullet_groups[map_y], self.zombie_groups[map_y]) + elif self.plant_name == c.GARLIC: + new_plant = plant.Garlic(x, y) + elif self.plant_name == c.PUMPKINHEAD: + new_plant = plant.PumpkinHead(x, y) if new_plant.can_sleep and self.background_type in c.DAYTIME_BACKGROUNDS: @@ -951,14 +940,14 @@ class Level(tool.State): else: self.menubar.deleateCard(self.select_plant) - if self.bar_type != c.CHOSSEBAR_BOWLING: # 坚果保龄球关卡无需考虑格子被占用的情况 + if self.bar_type != c.CHOOSEBAR_BOWLING: # 坚果保龄球关卡无需考虑格子被占用的情况 self.map.addMapPlant(map_x, map_y, self.plant_name, sleep=mushroomSleep) self.removeMouseImage() # print(self.newPlantAndPositon) # 播放种植音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "plant.ogg")).play() + c.SOUND_PLANT.play() def setupHintImage(self): pos = self.canSeedPlant(self.plant_name) @@ -974,7 +963,7 @@ class Level(tool.State): self.hint_image = image self.hint_rect = image.get_rect() # 花盆、睡莲图片应当下移一些 - if self.plant_name in {c.LILYPAD, '花盆(未实现)', c.TANGLEKLEP}: + if self.plant_name in {c.LILYPAD, "花盆(未实现)", c.TANGLEKLEP}: self.hint_rect.centerx = pos[0] self.hint_rect.bottom = pos[1] + 25 else: @@ -984,21 +973,17 @@ class Level(tool.State): else: self.hint_plant = False - def setupMouseImage(self, plant_name, select_plant): + def setupMouseImage(self, plant_name, select_plant, colorkey=c.BLACK): frame_list = tool.GFX[plant_name] - if plant_name in tool.PLANT_RECT: - data = tool.PLANT_RECT[plant_name] - x, y, width, height = data['x'], data['y'], data['width'], data['height'] + if plant_name in c.PLANT_RECT: + data = c.PLANT_RECT[plant_name] + x, y, width, height = data["x"], data["y"], data["width"], data["height"] else: x, y = 0, 0 rect = frame_list[0].get_rect() width, height = rect.w, rect.h - if (plant_name in c.PLANT_COLOR_KEY_WHITE): - color = c.WHITE - else: - color = c.BLACK - self.mouse_image = tool.get_image(frame_list[0], x, y, width, height, color, 1) + self.mouse_image = tool.get_image(frame_list[0], x, y, width, height, colorkey, 1) self.mouse_rect = self.mouse_image.get_rect() self.drag_plant = True self.plant_name = plant_name @@ -1063,7 +1048,7 @@ class Level(tool.State): # 如果被攻击植物是睡莲和花盆,同一格种了植物必然刷新 # 如果被攻击植物不是睡莲和花盆,同一格种了南瓜头才刷新 if ((zombie.prey.name not in {c.LILYPAD, "花盆(未实现)"}) - and (self.newPlantAndPositon[0] != "南瓜头(未实现)")): + and (self.newPlantAndPositon[0] != c.PUMPKINHEAD)): continue else: continue @@ -1079,7 +1064,7 @@ class Level(tool.State): for plant in self.plant_groups[i]: if collided_func(plant, zombie): # 优先攻击南瓜头 - if plant.name == "南瓜头(未实现)": + if plant.name == c.PUMPKINHEAD: targetPlant = plant break # 衬底植物情形 @@ -1104,7 +1089,7 @@ class Level(tool.State): for actualTargetPlant in self.plant_groups[i]: # 检测同一格的其他植物 if self.map.getMapIndex(actualTargetPlant.rect.centerx, actualTargetPlant.rect.bottom) == (map_x, map_y): - if actualTargetPlant.name == "南瓜头(未实现)": + if actualTargetPlant.name == c.PUMPKINHEAD: targetPlant = actualTargetPlant break elif actualTargetPlant.name not in {c.LILYPAD, "花盆(未实现)"}: @@ -1142,7 +1127,7 @@ class Level(tool.State): zombie.setDamage(c.WALLNUT_BOWLING_DAMAGE, damageType=c.ZOMBIE_WALLNUT_BOWLING_DANMAGE) targetPlant.changeDirection(i) # 播放撞击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "bowlingimpact.ogg")).play() + c.SOUND_BOWLING_IMPACT.play() elif targetPlant.name == c.REDWALLNUTBOWLING: if targetPlant.state == c.IDLE: targetPlant.setAttack() @@ -1171,6 +1156,7 @@ class Level(tool.State): for hypno_zombie in self.hypno_zombie_groups[i]: if hypno_zombie.health <= 0: continue + collided_func = pg.sprite.collide_mask zombie_list = pg.sprite.spritecollide( hypno_zombie, self.zombie_groups[i], False, collided_func) for zombie in zombie_list: @@ -1211,7 +1197,7 @@ class Level(tool.State): def freezeZombies(self, plant): # 播放冻结音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "freeze.ogg")).play() + c.SOUND_FREEZE.play() for i in range(self.map_y_len): for zombie in self.zombie_groups[i]: @@ -1242,13 +1228,13 @@ class Level(tool.State): self.plant_groups[map_y].add(plant.Hole(targetPlant.originalX, targetPlant.originalY, self.map.map[map_y][map_x][c.MAP_PLOT_TYPE])) elif targetPlant.name not in c.PLANT_DIE_SOUND_EXCEPTIONS: # 触发植物死亡音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "plantDie.ogg")).play() + c.SOUND_PLANT_DIE.play() else: # 用铲子移除植物时播放音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "plant.ogg")).play() + c.SOUND_PLANT.play() # 整理地图信息 - if self.bar_type != c.CHOSSEBAR_BOWLING: + if self.bar_type != c.CHOOSEBAR_BOWLING: self.map.removeMapPlant(map_x, map_y, targetPlant.name) # 将睡眠植物移除后更新睡眠状态 if targetPlant.state == c.SLEEP: @@ -1418,27 +1404,38 @@ class Level(tool.State): def checkGameState(self): if self.checkVictory(): - if self.game_info[c.GAME_MODE] == c.MODE_LITTLEGAME: - self.game_info[c.LITTLEGAME_NUM] += 1 - elif self.game_info[c.GAME_MODE] == c.MODE_ADVENTURE: + if self.game_info[c.GAME_MODE] == c.MODE_ADVENTURE: self.game_info[c.LEVEL_NUM] += 1 - self.next = c.GAME_VICTORY + if self.game_info[c.LEVEL_NUM] >= map.TOTAL_LEVEL: + self.game_info[c.LEVEL_COMPLETIONS] += 1 + self.game_info[c.LEVEL_NUM] = 1 + self.next = c.AWARD_SCREEN + # 播放大胜利音效 + c.SOUND_FINAL_FANFARE.play() + else: + self.next = c.GAME_VICTORY + # 播放胜利音效 + c.SOUND_WIN.play() + elif self.game_info[c.GAME_MODE] == c.MODE_LITTLEGAME: + self.game_info[c.LITTLEGAME_NUM] += 1 + if self.game_info[c.LITTLEGAME_NUM] >= map.TOTAL_LITTLE_GAME: + self.game_info[c.LITTLEGAME_COMPLETIONS] += 1 + self.game_info[c.LITTLEGAME_NUM] = 1 + self.next = c.AWARD_SCREEN + # 播放大胜利音效 + c.SOUND_FINAL_FANFARE.play() + else: + self.next = c.GAME_VICTORY + # 播放胜利音效 + c.SOUND_WIN.play() self.done = True - # 播放胜利音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "win.ogg")).play() - with open(c.USERDATA_PATH, "w") as f: - userdata = {} - for i in self.game_info: - if i in c.USERDATA_KEYS: - userdata[i] = self.game_info[i] - savedata = json.dumps(userdata, sort_keys=True, indent=4) - f.write(savedata) + self.saveUserData() elif self.checkLose(): + # 播放失败音效 + c.SOUND_LOSE.play() + c.SOUND_SCREAM.play() self.next = c.GAME_LOSE self.done = True - # 播放失败音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "lose.ogg")).play() - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "scream.ogg")).play() def drawMouseShow(self, surface): if self.hint_plant: @@ -1468,8 +1465,8 @@ class Level(tool.State): if c.LILYPAD in self.map.map[map_y][map_x][c.MAP_PLANT]: if i.name == c.LILYPAD: continue - elif '花盆(未实现)' in self.map.map[map_y][map_x][c.MAP_PLANT]: - if i.name == '花盆(未实现)': + elif "花盆(未实现)" in self.map.map[map_y][map_x][c.MAP_PLANT]: + if i.name == "花盆(未实现)": continue i.highlightTime = self.current_time return @@ -1484,14 +1481,14 @@ class Level(tool.State): surface.blit(self.level_progress_bar_image, self.level_progress_bar_image_rect) # 按照当前波数生成僵尸头位置 - self.level_progress_zombie_head_image_rect.x = self.level_progress_bar_image_rect.x - int((150 * self.waveNum) / (self.map_data[c.NUM_FLAGS] * 10)) + 145 # 常数为预计值 - self.level_progress_zombie_head_image_rect.y = self.level_progress_bar_image_rect.y - 3 # 常数为预计值 + self.level_progress_zombie_head_image_rect.x = self.level_progress_bar_image_rect.x - int((150 * self.waveNum) / (self.map_data[c.NUM_FLAGS] * 10)) + 145 # 常数为拟合值 + self.level_progress_zombie_head_image_rect.y = self.level_progress_bar_image_rect.y - 3 # 常数为拟合值 # 填充的进度条信息 - # 常数为预计值 + # 常数为拟合值 filledBarRect = (self.level_progress_zombie_head_image_rect.x + 3, self.level_progress_bar_image_rect.y + 6, int((150 * self.waveNum) / (self.map_data[c.NUM_FLAGS] * 10)) + 5, 9) # 画填充的进度条 - pg.draw.rect(surface, c.GREEN, filledBarRect) + pg.draw.rect(surface, c.YELLOWGREEN, filledBarRect) # 画旗帜 for i in range(self.numFlags): @@ -1506,6 +1503,23 @@ class Level(tool.State): # 画僵尸头 surface.blit(self.level_progress_zombie_head_image, self.level_progress_zombie_head_image_rect) + def showAllContentOfMenu(self, surface): + # 绘制不可变内容 + surface.blit(self.big_menu, self.big_menu_rect) + surface.blit(self.return_button, self.return_button_rect) + surface.blit(self.restart_button, self.restart_button_rect) + surface.blit(self.mainMenu_button, self.mainMenu_button_rect) + surface.blit(self.sound_volume_minus_button, self.sound_volume_minus_button_rect) + surface.blit(self.sound_volume_plus_button, self.sound_volume_plus_button_rect) + + # 显示当前音量 + # 由于音量可变,因此这一内容不能在一开始就结束加载,而应当不断刷新不断显示 + font = pg.font.Font(c.FONT_PATH, 30) + volume_tips = font.render(f"音量:{round(self.game_info[c.SOUND_VOLUME]*100):3}%", True, c.LIGHTGRAY) + volume_tips_rect = volume_tips.get_rect() + volume_tips_rect.x = 275 + volume_tips_rect.y = 247 + surface.blit(volume_tips, volume_tips_rect) def draw(self, surface): self.level.blit(self.background, self.viewport, self.viewport) @@ -1515,10 +1529,7 @@ class Level(tool.State): # 画小菜单 surface.blit(self.little_menu, self.little_menu_rect) if self.showLittleMenu: - surface.blit(self.big_menu, self.big_menu_rect) - surface.blit(self.return_button, self.return_button_rect) - surface.blit(self.restart_button, self.restart_button_rect) - surface.blit(self.mainMenu_button, self.mainMenu_button_rect) + self.showAllContentOfMenu(surface) # 以后可能需要插入一个预备的状态(预览显示僵尸、返回战场) elif self.state == c.PLAY: if self.hasShovel: @@ -1547,10 +1558,7 @@ class Level(tool.State): self.drawMouseShowPlus(surface) if self.showLittleMenu: - surface.blit(self.big_menu, self.big_menu_rect) - surface.blit(self.return_button, self.return_button_rect) - surface.blit(self.restart_button, self.restart_button_rect) - surface.blit(self.mainMenu_button, self.mainMenu_button_rect) + self.showAllContentOfMenu(surface) if self.map_data[c.SPAWN_ZOMBIES] == c.SPAWN_ZOMBIES_AUTO: self.showLevelProgress(surface) diff --git a/source/state/mainmenu.py b/source/state/mainmenu.py index 143a920..57702cc 100644 --- a/source/state/mainmenu.py +++ b/source/state/mainmenu.py @@ -2,7 +2,6 @@ import pygame as pg import os from .. import tool from .. import constants as c -from . import level class Menu(tool.State): @@ -15,6 +14,15 @@ class Menu(tool.State): self.game_info = persist self.setupBackground() self.setupOptions() + self.setupOptionMenu() + self.setupSunflowerTrophy() + pg.mixer.music.stop() + pg.mixer.music.load(os.path.join(c.PATH_MUSIC_DIR, "intro.opus")) + pg.mixer.music.play(-1, 0) + pg.display.set_caption(c.ORIGINAL_CAPTION) + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) + for i in c.SOUNDS: + i.set_volume(self.game_info[c.SOUND_VOLUME]) def setupBackground(self): frame_rect = (80, 0, 800, 600) @@ -30,13 +38,11 @@ class Menu(tool.State): def setupOptions(self): # 冒险模式 self.adventure_frames = [] - frame_names = (c.OPTION_ADVENTURE + '_0', c.OPTION_ADVENTURE + '_1') + frame_names = (f"{c.OPTION_ADVENTURE}_0", f"{c.OPTION_ADVENTURE}_1") frame_rect = (0, 0, 330, 144) - for name in frame_names: self.adventure_frames.append(tool.get_image_menu(tool.GFX[name], *frame_rect, c.BLACK, 1)) - self.adventure_frame_index = 0 - self.adventure_image = self.adventure_frames[self.adventure_frame_index] + self.adventure_image = self.adventure_frames[0] self.adventure_rect = self.adventure_image.get_rect() self.adventure_rect.x = 400 self.adventure_rect.y = 60 @@ -44,25 +50,35 @@ class Menu(tool.State): # 退出按钮 self.exit_frames = [] - exit_frame_names = (c.EXIT + '_0', c.EXIT + '_1') + exit_frame_names = (f"{c.EXIT}_0", f"{c.EXIT}_1") exit_frame_rect = (0, 0, 47, 27) for name in exit_frame_names: self.exit_frames.append(tool.get_image_menu(tool.GFX[name], *exit_frame_rect, c.BLACK, 1.1)) - self.exit_frame_index = 0 - self.exit_image = self.exit_frames[self.exit_frame_index] + self.exit_image = self.exit_frames[0] self.exit_rect = self.exit_image.get_rect() self.exit_rect.x = 730 self.exit_rect.y = 507 self.exit_highlight_time = 0 + # 选项按钮 + self.option_button_frames = [] + option_button_frame_names = (f"{c.OPTION_BUTTON}_0", f"{c.OPTION_BUTTON}_1") + option_button_frame_rect = (0, 0, 81, 31) + for name in option_button_frame_names: + self.option_button_frames.append(tool.get_image_menu(tool.GFX[name], *option_button_frame_rect, c.BLACK)) + self.option_button_image = self.option_button_frames[0] + self.option_button_rect = self.option_button_image.get_rect() + self.option_button_rect.x = 560 + self.option_button_rect.y = 490 + self.option_button_hightlight_time = 0 + # 小游戏 self.littleGame_frames = [] - littleGame_frame_names = (c.LITTLEGAME_BUTTON + '_0', c.LITTLEGAME_BUTTON + '_1') + littleGame_frame_names = (c.LITTLEGAME_BUTTON + "_0", c.LITTLEGAME_BUTTON + "_1") littleGame_frame_rect = (0, 7, 317, 135) for name in littleGame_frame_names: - self.littleGame_frames.append(tool.get_image_menu(tool.GFX[name], *frame_rect, c.BLACK, 1)) - self.littleGame_frame_index = 0 - self.littleGame_image = self.littleGame_frames[self.littleGame_frame_index] + self.littleGame_frames.append(tool.get_image_menu(tool.GFX[name], *littleGame_frame_rect, c.BLACK, 1)) + self.littleGame_image = self.littleGame_frames[0] self.littleGame_rect = self.littleGame_image.get_rect() self.littleGame_rect.x = 397 self.littleGame_rect.y = 175 @@ -71,108 +87,214 @@ class Menu(tool.State): self.adventure_start = 0 self.adventure_timer = 0 self.adventure_clicked = False - - def inAreaAdventure(self, x, y): - if (x >= self.adventure_rect.x and x <= self.adventure_rect.right and - y >= self.adventure_rect.y and y <= self.adventure_rect.bottom): - return True - else: - return False - - def inAreaExit(self, x, y): - if (x >= self.exit_rect.x and x <= self.exit_rect.right and - y >= self.exit_rect.y and y <= self.exit_rect.bottom): - return True - else: - return False - - def inAreaLittleGame(self, x, y): - if (x >= self.littleGame_rect.x and x <= self.littleGame_rect.right and - y >= self.littleGame_rect.y and y <= self.littleGame_rect.bottom): - return True - else: - return False + self.option_button_clicked = False def checkHilight(self, x, y): # 高亮冒险模式按钮 - if self.inAreaAdventure(x, y): + if self.inArea(self.adventure_rect, x, y): self.adventure_highlight_time = self.current_time # 高亮退出按钮 - elif self.inAreaExit(x, y): + elif self.inArea(self.exit_rect, x, y): self.exit_highlight_time = self.current_time + # 高亮选项按钮 + elif self.inArea(self.option_button_rect, x, y): + self.option_button_hightlight_time = self.current_time # 高亮小游戏按钮 - elif self.inAreaLittleGame(x, y): + elif self.inArea(self.littleGame_rect, x, y): self.littleGame_highlight_time = self.current_time + # 处理按钮高亮情况 + self.adventure_image = self.chooseHilightImage(self.adventure_highlight_time, self.adventure_frames) + self.exit_image = self.chooseHilightImage(self.exit_highlight_time, self.exit_frames) + self.option_button_image = self.chooseHilightImage(self.option_button_hightlight_time, self.option_button_frames) + self.littleGame_image = self.chooseHilightImage(self.littleGame_highlight_time, self.littleGame_frames) + + def chooseHilightImage(self, hilightTime, frames): + if (self.current_time - hilightTime) < 80: + index= 1 + else: + index = 0 + return frames[index] def checkAdventureClick(self, mouse_pos): x, y = mouse_pos - if self.inAreaAdventure(x, y): + if self.inArea(self.adventure_rect, x, y): self.adventure_clicked = True self.adventure_timer = self.adventure_start = self.current_time self.persist[c.GAME_MODE] = c.MODE_ADVENTURE # 播放进入音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "evillaugh.ogg")).play() - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "lose.ogg")).play() - return False + c.SOUND_EVILLAUGH.play() + c.SOUND_LOSE.play() # 点击到按钮,修改转态的done属性 def checkExitClick(self, mouse_pos): x, y = mouse_pos - if self.inAreaExit(x, y): + if self.inArea(self.exit_rect, x, y): self.done = True self.next = c.EXIT # 检查有没有按到小游戏 def checkLittleGameClick(self, mouse_pos): x, y = mouse_pos - if self.inAreaLittleGame(x, y): + if self.inArea(self.littleGame_rect, x, y): self.done = True self.persist[c.GAME_MODE] = c.MODE_LITTLEGAME # 播放点击音效 - pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "buttonclick.ogg")).play() + c.SOUND_BUTTON_CLICK.play() + + def setupOptionMenu(self): + # 选项菜单框 + frame_rect = (0, 0, 500, 500) + self.big_menu = tool.get_image_menu(tool.GFX[c.BIG_MENU], *frame_rect, c.BLACK, 1.1) + self.big_menu_rect = self.big_menu.get_rect() + self.big_menu_rect.x = 150 + self.big_menu_rect.y = 0 + + # 返回按钮,用字体渲染实现,增强灵活性 + # 建立一个按钮大小的surface对象 + self.return_button = pg.Surface((376, 96)) + self.return_button.set_colorkey(c.BLACK) # 避免多余区域显示成黑色 + self.return_button_rect = self.return_button.get_rect() + self.return_button_rect.x = 220 + self.return_button_rect.y = 440 + font = pg.font.Font(c.FONT_PATH, 40) + font.bold = True + text = font.render("返回游戏", True, c.YELLOWGREEN) + text_rect = text.get_rect() + text_rect.x = 105 + text_rect.y = 18 + self.return_button.blit(text, text_rect) + + # 音量+、音量- + frame_rect = (0, 0, 39, 41) + font = pg.font.Font(c.FONT_PATH, 35) + font.bold = True + # 音量+ + self.sound_volume_plus_button = tool.get_image_menu(tool.GFX[c.SOUND_VOLUME_BUTTON], *frame_rect, c.BLACK) + sign = font.render("+", True, c.YELLOWGREEN) + sign_rect = sign.get_rect() + sign_rect.x = 8 + sign_rect.y = -4 + self.sound_volume_plus_button.blit(sign, sign_rect) + self.sound_volume_plus_button_rect = self.sound_volume_plus_button.get_rect() + self.sound_volume_plus_button_rect.x = 500 + # 音量- + self.sound_volume_minus_button = tool.get_image_menu(tool.GFX[c.SOUND_VOLUME_BUTTON], *frame_rect, c.BLACK) + sign = font.render("-", True, c.YELLOWGREEN) + sign_rect = sign.get_rect() + sign_rect.x = 12 + sign_rect.y = -6 + self.sound_volume_minus_button.blit(sign, sign_rect) + self.sound_volume_minus_button_rect = self.sound_volume_minus_button.get_rect() + self.sound_volume_minus_button_rect.x = 450 + # 音量+、-应当处于同一高度 + self.sound_volume_minus_button_rect.y = self.sound_volume_plus_button_rect.y = 250 + + def setupSunflowerTrophy(self): + # 设置金银向日葵图片信息 + if (self.game_info[c.LEVEL_COMPLETIONS] or self.game_info[c.LITTLEGAME_COMPLETIONS]): + if (self.game_info[c.LEVEL_COMPLETIONS] and self.game_info[c.LITTLEGAME_COMPLETIONS]): + frame_rect = (157, 0, 157, 269) + else: + frame_rect = (0, 0, 157, 269) + self.sunflower_trophy = tool.get_image_menu(tool.GFX[c.TROPHY_SUNFLOWER], *frame_rect, c.BLACK) + self.sunflower_trophy_rect = self.sunflower_trophy.get_rect() + self.sunflower_trophy_rect.x = 0 + self.sunflower_trophy_rect.y = 280 + self.sunflower_trophy_show_info_time = 0 + + def checkSunflowerTrophyInfo(self, surface, x, y): + if self.inArea(self.sunflower_trophy_rect, x, y): + self.sunflower_trophy_show_info_time = self.current_time + if (self.current_time - self.sunflower_trophy_show_info_time) < 80: + font = pg.font.Font(c.FONT_PATH, 14) + if (self.game_info[c.LEVEL_COMPLETIONS] and self.game_info[c.LITTLEGAME_COMPLETIONS]): + infoText = f"目前您一共完成了:冒险模式{self.game_info[c.LEVEL_COMPLETIONS]}轮,玩玩小游戏{self.game_info[c.LITTLEGAME_COMPLETIONS]}轮" + elif self.game_info[c.LEVEL_COMPLETIONS]: + infoText = f"目前您一共完成了:冒险模式{self.game_info[c.LEVEL_COMPLETIONS]}轮;完成其他所有游戏模式以获得金向日葵奖杯!" + else: + infoText = f"目前您一共完成了:玩玩小游戏{self.game_info[c.LITTLEGAME_COMPLETIONS]}轮;完成其他所有游戏模式以获得金向日葵奖杯!" + infoImg = font.render(infoText , True, c.BLACK, c.LIGHTYELLOW) + infoImg_rect = infoImg.get_rect() + infoImg_rect.x = x + infoImg_rect.y = y + surface.blit(infoImg, infoImg_rect) + + def checkOptionButtonClick(self, mouse_pos): + x, y = mouse_pos + if self.inArea(self.option_button_rect, x, y): + self.option_button_clicked = True + # 播放点击音效 + c.SOUND_BUTTON_CLICK.play() + + def showCurrentVolumeImage(self, surface): + # 由于音量可变,因此这一内容不能在一开始就结束加载,而应当不断刷新不断显示 + font = pg.font.Font(c.FONT_PATH, 30) + volume_tips = font.render(f"音量:{round(self.game_info[c.SOUND_VOLUME]*100):3}%", True, c.LIGHTGRAY) + volume_tips_rect = volume_tips.get_rect() + volume_tips_rect.x = 275 + volume_tips_rect.y = 247 + surface.blit(volume_tips, volume_tips_rect) def update(self, surface, current_time, mouse_pos, mouse_click): self.current_time = self.game_info[c.CURRENT_TIME] = current_time - # 没有选到选项时,检查有没有点到选项 - if not self.adventure_clicked: - # 先检查选项高亮预览 - x, y = pg.mouse.get_pos() - self.checkHilight(x, y) - if (self.current_time - self.adventure_highlight_time) < 80: - self.adventure_frame_index = 1 - else: - self.adventure_frame_index = 0 - self.adventure_image = self.adventure_frames[self.adventure_frame_index] - if (self.current_time - self.exit_highlight_time) < 80: - self.exit_frame_index = 1 - else: - self.exit_frame_index = 0 - self.exit_image = self.exit_frames[self.exit_frame_index] - if (self.current_time - self.littleGame_highlight_time) < 80: - self.littleGame_frame_index= 1 - else: - self.littleGame_frame_index = 0 - self.littleGame_image = self.littleGame_frames[self.littleGame_frame_index] - - if mouse_pos: - self.checkExitClick(mouse_pos) - self.checkLittleGameClick(mouse_pos) - self.checkAdventureClick(mouse_pos) - else: - # 点到后播放动画 - if(self.current_time - self.adventure_timer) > 150: - self.adventure_frame_index += 1 - if self.adventure_frame_index >= 2: - self.adventure_frame_index = 0 - self.adventure_timer = self.current_time - self.adventure_image = self.adventure_frames[self.adventure_frame_index] - if(self.current_time - self.adventure_start) > 3200: - self.done = True - - surface.blit(self.bg_image, self.bg_rect) surface.blit(self.adventure_image, self.adventure_rect) surface.blit(self.exit_image, self.exit_rect) + surface.blit(self.option_button_image, self.option_button_rect) surface.blit(self.littleGame_image, self.littleGame_rect) + if self.game_info[c.LEVEL_COMPLETIONS] or self.game_info[c.LITTLEGAME_COMPLETIONS]: + surface.blit(self.sunflower_trophy, self.sunflower_trophy_rect) + + # 点到冒险模式后播放动画 + if self.adventure_clicked: + # 乱写一个不用信号标记的循环播放 QwQ + if ((self.current_time - self.adventure_timer) // 150) % 2: + self.adventure_image = self.adventure_frames[1] + else: + self.adventure_image = self.adventure_frames[0] + if (self.current_time - self.adventure_start) > 3200: + self.done = True + # 点到选项按钮后显示菜单 + elif self.option_button_clicked: + surface.blit(self.big_menu, self.big_menu_rect) + surface.blit(self.return_button, self.return_button_rect) + surface.blit(self.sound_volume_plus_button, self.sound_volume_plus_button_rect) + surface.blit(self.sound_volume_minus_button, self.sound_volume_minus_button_rect) + self.showCurrentVolumeImage(surface) + if mouse_pos: + # 返回 + if self.inArea(self.return_button_rect, *mouse_pos): + self.option_button_clicked = False + c.SOUND_BUTTON_CLICK.play() + # 音量+ + elif self.inArea(self.sound_volume_plus_button_rect, *mouse_pos): + self.game_info[c.SOUND_VOLUME] = round(min(self.game_info[c.SOUND_VOLUME] + 0.05, 1), 2) + # 一般不会有人想把音乐和音效分开设置,故pg.mixer.Sound.set_volume()和pg.mixer.music.set_volume()需要一起用 + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) + for i in c.SOUNDS: + i.set_volume(self.game_info[c.SOUND_VOLUME]) + c.SOUND_BUTTON_CLICK.play() + self.saveUserData() + # 音量- + elif self.inArea(self.sound_volume_minus_button_rect, *mouse_pos): + self.game_info[c.SOUND_VOLUME] = round(max(self.game_info[c.SOUND_VOLUME] - 0.05, 0), 2) + # 一般不会有人想把音乐和音效分开设置,故pg.mixer.Sound.set_volume()和pg.mixer.music.set_volume()需要一起用 + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) + for i in c.SOUNDS: + i.set_volume(self.game_info[c.SOUND_VOLUME]) + c.SOUND_BUTTON_CLICK.play() + self.saveUserData() + # 没有点到前两者时常规行检测所有按钮的点击和高亮 + else: + # 先检查选项高亮预览 + x, y = pg.mouse.get_pos() + self.checkHilight(x, y) + if (self.game_info[c.LEVEL_COMPLETIONS] or self.game_info[c.LITTLEGAME_COMPLETIONS]): + self.checkSunflowerTrophyInfo(surface, x, y) + if mouse_pos: + self.checkExitClick(mouse_pos) + self.checkOptionButtonClick(mouse_pos) + self.checkLittleGameClick(mouse_pos) + self.checkAdventureClick(mouse_pos) diff --git a/source/state/screen.py b/source/state/screen.py index a08793e..6580576 100644 --- a/source/state/screen.py +++ b/source/state/screen.py @@ -1,3 +1,4 @@ +import os import pygame as pg from .. import tool from .. import constants as c @@ -5,53 +6,211 @@ from .. import constants as c class Screen(tool.State): def __init__(self): tool.State.__init__(self) - self.end_time = 3000 def startup(self, current_time, persist): - self.start_time = current_time - self.next = c.LEVEL - self.persist = persist - self.game_info = persist - name = self.getImageName() - self.setupImage(name) - self.next = self.set_next_state() - - def getImageName(self): pass - def set_next_state(self): - pass - - def setupImage(self, name): - frame_rect = [0, 0, 800, 600] - self.image = tool.get_image(tool.GFX[name], *frame_rect) + def setupImage(self, name, frame_rect=(0, 0, 800, 600), color_key=c.BLACK): + # 背景图本身 + self.image = tool.get_image(tool.GFX[name], *frame_rect, colorkey=color_key) self.rect = self.image.get_rect() self.rect.x = 0 self.rect.y = 0 - def update(self, surface, current_time, mouse_pos, mouse_click): - if (current_time - self.start_time) < self.end_time: - surface.fill(c.WHITE) - surface.blit(self.image, self.rect) + # 按钮 + frame_rect = (0, 0, 111, 26) + ## 主菜单按钮 + self.main_menu_button_image = tool.get_image_menu(tool.GFX[c.UNIVERSAL_BUTTON], *frame_rect) + self.main_menu_button_image_rect = self.main_menu_button_image.get_rect() + self.main_menu_button_image_rect.x = 620 + ### 主菜单按钮上的文字 + font = pg.font.Font(c.FONT_PATH, 18) + main_menu_text = font.render("主菜单", True, c.NAVYBLUE) + main_menu_text_rect = main_menu_text.get_rect() + main_menu_text_rect.x = 29 + ## 继续按钮 + self.next_button_image = tool.get_image_menu(tool.GFX[c.UNIVERSAL_BUTTON], *frame_rect) + self.next_button_image_rect = self.next_button_image.get_rect() + self.next_button_image_rect.x = 70 + ### 继续按钮上的文字 + if name == c.GAME_VICTORY_IMAGE: + next_text = font.render("下一关", True, c.NAVYBLUE) + next_text_rect = next_text.get_rect() + next_text_rect.x = 29 + self.next_button_image_rect.y = self.main_menu_button_image_rect.y = 555 else: - self.done = True + next_text = font.render("重新开始", True, c.NAVYBLUE) + next_text_rect = next_text.get_rect() + next_text_rect.x = 21 + self.next_button_image_rect.y = self.main_menu_button_image_rect.y = 530 + self.next_button_image.blit(next_text, next_text_rect) + self.main_menu_button_image.blit(main_menu_text, main_menu_text_rect) + self.image.blit(self.next_button_image, self.next_button_image_rect) + self.image.blit(self.main_menu_button_image, self.main_menu_button_image_rect) + + def update(self, surface, current_time, mouse_pos, mouse_click): + surface.fill(c.WHITE) + surface.blit(self.image, self.rect) + if mouse_pos: + # 点到继续 + if self.inArea(self.next_button_image_rect, *mouse_pos): + self.next = c.LEVEL + self.done = True + # 点到主菜单 + elif self.inArea(self.main_menu_button_image_rect, *mouse_pos): + self.next = c.MAIN_MENU + self.done = True class GameVictoryScreen(Screen): def __init__(self): Screen.__init__(self) + self.image_name = c.GAME_VICTORY_IMAGE - def getImageName(self): - return c.GAME_VICTORY_IMAGE - - def set_next_state(self): - return c.LEVEL + def startup(self, current_time, persist): + self.start_time = current_time + self.persist = persist + self.game_info = persist + self.setupImage(self.image_name) + pg.display.set_caption("pypvz: 战斗胜利!") + pg.mixer.music.stop() + pg.mixer.music.load(os.path.join(c.PATH_MUSIC_DIR, "zenGarden.opus")) + pg.mixer.music.play(-1, 0) + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) class GameLoseScreen(Screen): def __init__(self): Screen.__init__(self) + self.image_name = c.GAME_LOSE_IMAGE - def getImageName(self): - return c.GAME_LOSE_IMAGE - - def set_next_state(self): - return c.LEVEL + def startup(self, current_time, persist): + self.start_time = current_time + self.persist = persist + self.game_info = persist + self.setupImage(self.image_name, (-118, -40, 800, 600), c.WHITE) + pg.display.set_caption("pypvz: 战斗失败!") + # 停止播放原来关卡中的音乐 + pg.mixer.music.stop() + +class AwardScreen(tool.State): + def __init__(self): + tool.State.__init__(self) + + def setupImage(self): + # 主体 + frame_rect = (0, 0, 800, 600) + self.image = tool.get_image(tool.GFX[c.AWARD_SCREEN_IMAGE], *frame_rect) + self.rect = self.image.get_rect() + self.rect.x = 0 + self.rect.y = 0 + + # 文字 + # 标题处文字 + font = pg.font.Font(c.FONT_PATH, 37) + title_text = font.render("您获得了新的战利品!", True, c.PARCHMENT_YELLOW) + title_text_rect = title_text.get_rect() + title_text_rect.x = 220 + title_text_rect.y = 23 + self.image.blit(title_text, title_text_rect) + + # 按钮 + frame_rect = (0, 0, 111, 26) + if self.show_only_one_option: + ## 主菜单按钮 + self.main_menu_button_image = tool.get_image_menu(tool.GFX[c.UNIVERSAL_BUTTON], *frame_rect) + self.main_menu_button_image_rect = self.main_menu_button_image.get_rect() + self.main_menu_button_image_rect.x = 343 + self.main_menu_button_image_rect.y = 520 + ### 主菜单按钮上的文字 + font = pg.font.Font(c.FONT_PATH, 18) + main_menu_text = font.render("主菜单", True, c.NAVYBLUE) + main_menu_text_rect = main_menu_text.get_rect() + main_menu_text_rect.x = 29 + self.main_menu_button_image.blit(main_menu_text, main_menu_text_rect) + self.image.blit(self.main_menu_button_image, self.main_menu_button_image_rect) + else: + ## 继续按钮 + self.next_button_image = tool.get_image_menu(tool.GFX[c.UNIVERSAL_BUTTON], *frame_rect) + self.next_button_image_rect = self.next_button_image.get_rect() + self.next_button_image_rect.x = 70 + ### 继续按钮上的文字 + font = pg.font.Font(c.FONT_PATH, 18) + next_text = font.render("继续", True, c.NAVYBLUE) + next_text_rect = next_text.get_rect() + next_text_rect.x = 37 + ## 主菜单按钮 + self.main_menu_button_image = tool.get_image_menu(tool.GFX[c.UNIVERSAL_BUTTON], *frame_rect) + self.main_menu_button_image_rect = self.main_menu_button_image.get_rect() + self.main_menu_button_image_rect.x = 620 + self.next_button_image_rect.y = self.main_menu_button_image_rect.y = 540 + ### 主菜单按钮上的文字 + main_menu_text = font.render("主菜单", True, c.NAVYBLUE) + main_menu_text_rect = main_menu_text.get_rect() + main_menu_text_rect.x = 29 + self.next_button_image.blit(next_text, next_text_rect) + self.main_menu_button_image.blit(main_menu_text, main_menu_text_rect) + self.image.blit(self.next_button_image, self.next_button_image_rect) + self.image.blit(self.main_menu_button_image, self.main_menu_button_image_rect) + + # 显示向日葵奖杯的情况 + if self.show_only_one_option: + # 绘制向日葵奖杯 + if (self.game_info[c.LEVEL_COMPLETIONS] and self.game_info[c.LITTLEGAME_COMPLETIONS]): + frame_rect = (157, 0, 157, 269) + intro_title = "金向日葵奖杯" + intro_content = "您已通过所有关卡,获得此奖励!" + else: + frame_rect = (0, 0, 157, 269) + intro_title = "银向日葵奖杯" + if self.game_info[c.LEVEL_COMPLETIONS]: + intro_content = "您已完成冒险模式,获得此奖励!" + else: + intro_content = "您已完成玩玩小游戏,获得此奖励!" + sunflower_trophy_image = tool.get_image_menu(tool.GFX[c.TROPHY_SUNFLOWER], *frame_rect, scale=0.7) + sunflower_trophy_rect = sunflower_trophy_image.get_rect() + sunflower_trophy_rect.x = 348 + sunflower_trophy_rect.y = 108 + self.image.blit(sunflower_trophy_image, sunflower_trophy_rect) + + # 绘制介绍标题 + font = pg.font.Font(c.FONT_PATH, 22) + intro_title_img = font.render(intro_title, True, c.PARCHMENT_YELLOW) + intro_title_rect = intro_title_img.get_rect() + intro_title_rect.x = 333 + intro_title_rect.y = 305 + self.image.blit(intro_title_img, intro_title_rect) + + # 绘制介绍内容 + font = pg.font.Font(c.FONT_PATH, 15) + intro_content_img = font.render(intro_content, True, c.NAVYBLUE) + intro_content_rect = intro_content_img.get_rect() + intro_content_rect.x = 290 + intro_content_rect.y = 370 + self.image.blit(intro_content_img, intro_content_rect) + + + def startup(self, current_time, persist): + self.start_time = current_time + self.persist = persist + self.game_info = persist + if (c.PASSED_ALL in self.game_info) and (not self.game_info[c.PASSED_ALL]): + self.show_only_one_option = False + else: + self.show_only_one_option = True + self.setupImage() + pg.display.set_caption("pypvz: 您获得了新的战利品!") + pg.mixer.music.stop() + pg.mixer.music.load(os.path.join(c.PATH_MUSIC_DIR, "zenGarden.opus")) + pg.mixer.music.play(-1, 0) + pg.mixer.music.set_volume(self.game_info[c.SOUND_VOLUME]) + + def update(self, surface, current_time, mouse_pos, mouse_click): + surface.blit(self.image, self.rect) + if mouse_pos: + # 检查主菜单点击 + if self.inArea(self.main_menu_button_image_rect, *mouse_pos): + self.next = c.MAIN_MENU + self.done = True + elif not self.show_only_one_option: + if self.inArea(self.next_button_image_rect, *mouse_pos): + self.next = c.LEVEL + self.done = True diff --git a/source/tool.py b/source/tool.py index cbebcf6..04cb8b9 100755 --- a/source/tool.py +++ b/source/tool.py @@ -1,6 +1,5 @@ import os import json -import sys from abc import abstractmethod import pygame as pg from pygame.locals import * @@ -18,7 +17,8 @@ class State(): # 当从其他状态进入这个状态时,需要进行的初始化操作 @abstractmethod def startup(self, current_time, persist): - '''abstract method''' + # abstract method + pass # 当从这个状态退出时,需要进行的清除操作 def cleanup(self): self.done = False @@ -26,7 +26,26 @@ class State(): # 在这个状态运行时进行的更新操作 @abstractmethod def update(self, surface, keys, current_time): - '''abstract method''' + # abstract method + pass + + # 工具:范围判断函数,用于判断点击 + def inArea(self, rect, x, y): + if (x >= rect.x and x <= rect.right and + y >= rect.y and y <= rect.bottom): + return True + else: + return False + + # 工具:用户数据保存函数 + def saveUserData(self): + with open(c.USERDATA_PATH, "w") as f: + userdata = {} + for i in self.game_info: + if i in c.INIT_USERDATA: + userdata[i] = self.game_info[i] + data_to_save = json.dumps(userdata, sort_keys=True, indent=4) + f.write(data_to_save) # control this game. do event loops class Control(): @@ -34,7 +53,6 @@ class Control(): self.screen = pg.display.get_surface() self.done = False self.clock = pg.time.Clock() # 创建一个对象来帮助跟踪时间 - self.fps = 50 * c.GAME_RATE self.keys = pg.key.get_pressed() self.mouse_pos = None self.mouse_click = [False, False] # value:[left mouse click, right mouse click] @@ -42,27 +60,37 @@ class Control(): self.state_dict = {} self.state_name = None self.state = None + # 这里需要考虑多种情况,如文件不存在、文件不可读、文件不符合JSON语法要求,这些情况目前暂定统一进行新建文件操作 + # 因此仍然采用try-except实现而非if-else实现 try: # 存在存档即导入 with open(c.USERDATA_PATH) as f: userdata = json.load(f) - # 导入数据 - self.game_info = {c.CURRENT_TIME:0} # 时间信息需要新建 - self.game_info.update(userdata) - except FileNotFoundError: - # 不存在存档即新建 - userdata = {c.LEVEL_NUM:c.START_LEVEL_NUM, - c.LITTLEGAME_NUM:c.START_LITTLE_GAME_NUM, - c.LEVEL_COMPLETIONS:c.START_LEVEL_COMPLETIONS, - c.LITTLEGAME_COMPLETIONS:c.START_LITTLEGAME_COMPLETIONS - } + self.game_info = {} + # 导入数据,保证了可运行性,但是放弃了数据向后兼容性,即假如某些变量在以后改名,在导入时可能会被重置 + need_to_rewrite = False + for key in c.INIT_USERDATA: + if key in userdata: + self.game_info[key] = userdata[key] + else: + self.game_info[key] = c.INIT_USERDATA[key] + need_to_rewrite = True + if need_to_rewrite: + with open(c.USERDATA_PATH, "w") as f: + savedata = json.dumps(self.game_info, sort_keys=True, indent=4) + f.write(savedata) + except: if not os.path.exists(os.path.dirname(c.USERDATA_PATH)): os.makedirs(os.path.dirname(c.USERDATA_PATH)) with open(c.USERDATA_PATH, "w") as f: - savedata = json.dumps(userdata, sort_keys=True, indent=4) + savedata = json.dumps(c.INIT_USERDATA, sort_keys=True, indent=4) f.write(savedata) - self.game_info = userdata - self.game_info[c.CURRENT_TIME] = 0 # 时间信息需要新建 + self.game_info = c.INIT_USERDATA.copy() # 内部全是不可变对象,浅拷贝即可 + # 存档内不包含即时游戏时间信息,需要新建 + self.game_info[c.CURRENT_TIME] = 0 + + # 50为目前的基础帧率,乘以倍率即是游戏帧率 + self.fps = 50 * self.game_info[c.GAME_RATE] def setup_states(self, state_dict, start_state): @@ -73,7 +101,7 @@ class Control(): def update(self): # 返回自 pygame_init() 调用以来的毫秒数 * 游戏速度倍率 - self.current_time = pg.time.get_ticks() * c.GAME_RATE + self.current_time = pg.time.get_ticks() * self.game_info[c.GAME_RATE] if self.state.done: self.flip_state() @@ -101,9 +129,9 @@ class Control(): elif event.type == pg.KEYDOWN: self.keys = pg.key.get_pressed() if event.key == pg.K_f: - SCREEN = pg.display.set_mode(c.SCREEN_SIZE, pg.HWSURFACE|pg.FULLSCREEN) + pg.display.set_mode(c.SCREEN_SIZE, pg.HWSURFACE|pg.FULLSCREEN) elif event.key == pg.K_u: - SCREEN = pg.display.set_mode(c.SCREEN_SIZE) + pg.display.set_mode(c.SCREEN_SIZE) elif event.type == pg.KEYUP: self.keys = pg.key.get_pressed() elif event.type == pg.MOUSEBUTTONDOWN: @@ -120,9 +148,9 @@ class Control(): self.update() pg.display.flip() self.clock.tick(self.fps) - print('game over') def get_image(sheet, x, y, width, height, colorkey=c.BLACK, scale=1): + # 不保留alpha通道的图片导入 image = pg.Surface([width, height]) rect = image.get_rect() @@ -135,7 +163,7 @@ def get_image(sheet, x, y, width, height, colorkey=c.BLACK, scale=1): return image def get_image_menu(sheet, x, y, width, height, colorkey=c.BLACK, scale=1): - # 一定要保留阿尔法通道,修复主菜单bug,游戏中car显示又有bug + # 保留alpha通道的图片导入 image = pg.Surface([width, height], SRCALPHA) rect = image.get_rect() @@ -149,7 +177,7 @@ def get_image_menu(sheet, x, y, width, height, colorkey=c.BLACK, scale=1): def load_image_frames(directory, image_name, colorkey, accept): frame_list = [] tmp = {} - # image_name is "Peashooter", pic name is 'Peashooter_1', get the index 1 + # image_name is "Peashooter", pic name is "Peashooter_1", get the index 1 index_start = len(image_name) + 1 frame_num = 0 for pic in os.listdir(directory): @@ -170,7 +198,7 @@ def load_image_frames(directory, image_name, colorkey, accept): return frame_list # colorkeys 是设置图像中的某个颜色值为透明,这里用来消除白边 -def load_all_gfx(directory, colorkey=c.WHITE, accept=('.png', '.jpg', '.bmp', '.gif', 'webp')): +def load_all_gfx(directory, colorkey=c.WHITE, accept=(".png", ".jpg", ".bmp", ".gif", "webp")): graphics = {} for name1 in os.listdir(directory): # subfolders under the folder resources\graphics @@ -184,7 +212,7 @@ def load_all_gfx(directory, colorkey=c.WHITE, accept=('.png', '.jpg', '.bmp', '. dir3 = os.path.join(dir2, name3) # e.g. subfolders or pics under the folder resources\graphics\Zombies\ConeheadZombie if os.path.isdir(dir3): - # e.g. it's the folder resources\graphics\Zombies\ConeheadZombie\ConeheadZombieAttack + # e.g. it"s the folder resources\graphics\Zombies\ConeheadZombie\ConeheadZombieAttack image_name, _ = os.path.splitext(name3) graphics[image_name] = load_image_frames(dir3, image_name, colorkey, accept) else: @@ -205,33 +233,10 @@ def load_all_gfx(directory, colorkey=c.WHITE, accept=('.png', '.jpg', '.bmp', '. graphics[name] = img return graphics -# 从文件加载矩形碰撞范围 -# 用于消除文件边框影响 -def loadZombieImageRect(): - file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'resources', 'data', 'entity', 'zombie.json') - with open(file_path) as f: - data = json.load(f) - return data[c.ZOMBIE_IMAGE_RECT] - -def loadPlantImageRect(): - file_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'resources', 'data', 'entity', 'plant.json') - with open(file_path) as f: - data = json.load(f) - return data[c.PLANT_IMAGE_RECT] - -pg.init() pg.display.set_caption(c.ORIGINAL_CAPTION) # 设置标题 SCREEN = pg.display.set_mode(c.SCREEN_SIZE) # 设置初始屏幕 -try: # 设置窗口图标,仅对非Nuitka时生效,Nuitka不需要包括额外的图标文件,自动跳过这一过程即可 - pg.display.set_icon(pg.image.load(os.path.join(os.path.dirname(os.path.dirname(__file__)), c.ORIGINAL_LOGO))) -except: - pass +pg.mixer.set_num_channels(255) # 设置可以同时播放的音频数量,默认为8,经常不够用 +if os.path.exists(c.ORIGINAL_LOGO): # 设置窗口图标,仅对非Nuitka时生效,Nuitka不需要包括额外的图标文件,自动跳过这一过程即可 + pg.display.set_icon(pg.image.load(c.ORIGINAL_LOGO)) -GFX = load_all_gfx(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,os.path.join("resources","graphics"))) -ZOMBIE_RECT = loadZombieImageRect() -PLANT_RECT = loadPlantImageRect() - -# 播放音乐 -pg.mixer.init() -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 +GFX = load_all_gfx(c.PATH_IMG_DIR) diff --git a/update.sh b/update.sh deleted file mode 100755 index c32df87..0000000 --- a/update.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -cd `dirname $0`; pwd -git add * -git add .gitignore -git commit -m 'Updated by update.sh' -git push -u git@github.com:wszqkzqk/pypvz.git -