2 Star 5 Fork 2

猫姐/LearnCC

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
setting.py 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
猫姐 提交于 2021-10-16 22:03 . 代码重构,暂时不能正常运行
import pygame
# 主菜单选择
GAME_MENU_MODE = 1
# 学习模式
GAME_STUDY_MODE = 2
# 关卡选择
GAME_LEVEL_MODE = 3
# 娱乐模式
GAME_PLAY_MODE = 4
# 全部通关
GAME_PASS_ALL_MODE = 5
# 游戏结束
GAME_OVER_FAIL_MODE = 6
FPS = 60
WIDTH = 1280
HEIGHT = 720
font_path = "./font/jiangxizhuokai20.TTF"
CONFIG_FILE = './config.txt'
GAME_TITTLE = "植物大战僵尸———快乐识字版"
pygame.display.set_caption(GAME_TITTLE)
ICON_IMG = "./images/desktop.png"
ICON = pygame.image.load(ICON_IMG)
pygame.display.set_icon(ICON)
BG_STUDY_IMG = "images/bg_study_image.png"
BG_PLAY_IMG = "./images/rest/bg.png"
BG_LEVEL_CHOOSE_IMG = "images/rest/bg_game_choose.png"
BG_MENU_IMG = "./images/menu_bg.png"
GAME_FAIL_IMG = "./images/game_over.png"
GAME_PASS_ALL_IMG = "images/game_pass_all.png"
study_mode_bg = pygame.image.load(BG_STUDY_IMG)
play_mode_bg = pygame.image.load(BG_PLAY_IMG)
level_choose_mode_bg = pygame.image.load(BG_LEVEL_CHOOSE_IMG)
menu_mode_bg = pygame.image.load(BG_MENU_IMG)
game_pass_all_bg = pygame.image.load(GAME_PASS_ALL_IMG)
game_fail_widget = pygame.image.load(GAME_FAIL_IMG)
# 游戏结束背景
game_over_bg = pygame.Surface((1280, 720))
game_over_bg.fill("gray")
game_over_bg.set_alpha(3) # 设置透明度
pos_play_list = [(95, 120), (95, 218), (95, 315), (95, 423), (95, 532), (95, 635)]
pos_bullet_list = [(170, 120), (170, 220), (170, 315), (170, 423), (170, 532), (170, 635)]
pos_zombie_list = [(1000, 110), (1000, 320), (1000, 525)]
fd = open(CONFIG_FILE, "r")
total_cc_count = int(fd.readline())
GAME_LEVEL_MAX = total_cc_count//7
all_cc_labels = [i for i in range(1, total_cc_count + 1)]
def get_bg_music():
pygame.mixer.init()
BG_PLAY_MUSIC = "./sounds/bgm.wav"
game_play_mode_music = pygame.mixer.Sound(BG_PLAY_MUSIC)
game_play_mode_music.set_volume(0.15)
return game_play_mode_music
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/python4fun/LearnCC.git
[email protected]:python4fun/LearnCC.git
python4fun
LearnCC
LearnCC
master

搜索帮助