代码拉取完成,页面将自动刷新
同步操作将从 Lucy2020/TankWar 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import os
from pygame import Rect
class Settings:
# 游戏设置
FPS = 60 # 游戏帧率
GAME_NAME = "坦克大战" # 游戏标题
BOX_SIZE = 50 # 单位屏幕大小
BOX_RECT = Rect(0, 0, BOX_SIZE, BOX_SIZE) # 单位屏幕矩形
SCREEN_RECT = Rect(0, 0, BOX_SIZE * 19, BOX_SIZE * 13) # 屏幕矩形
SCREEN_COLOR = (0, 0, 0) # 屏幕颜色
# 通用变量
LEFT = 0
RIGHT = 1
UP = 2
DOWN = 3
# 地图
MAP_ONE = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, ],
[0, 1, 0, 0, 1, 3, 3, 1, 1, 2, 1, 1, 3, 3, 1, 0, 0, 1, 0, ],
[0, 1, 0, 0, 1, 3, 3, 1, 1, 2, 1, 1, 3, 3, 1, 0, 0, 1, 0, ],
[0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, ],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ],
[1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, ],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, ],
[0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, ],
[0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, ],
[0, 1, 3, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 1, 0, ],
[0, 1, 3, 3, 3, 1, 0, 0, 1, 1, 1, 0, 0, 1, 3, 3, 3, 1, 0, ],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, ],
]
# 音频
BOOM_MUSIC = "resources/musics/boom.wav"
FIRE_MUSIC = "resources/musics/fire.wav"
HIT_MUSIC = "resources/musics/hit.wav"
# 坦克类型
HERO = 0
ENEMY = 1
# 我方坦克
HERO_IMAGE_NAME = "./resources/images/hero/hero1U.gif"
HERO_IMAGES = {
LEFT: "./resources/images/hero/hero1L.gif",
RIGHT: "./resources/images/hero/hero1R.gif",
UP: "./resources/images/hero/hero1U.gif",
DOWN: "./resources/images/hero/hero1D.gif"
}
HERO_SPEED = 2
BOSS_IMAGE = "./resources/images/5.png"
# 我方老家
# 敌方坦克
ENEMY_IMAGES = {
LEFT: "./resources/images/enemy/enemy2L.gif",
RIGHT: "./resources/images/enemy/enemy2R.gif",
UP: "./resources/images/enemy/enemy2U.gif",
DOWN: "./resources/images/enemy/enemy2D.gif"
}
ENEMY_COUNT = 5
ENEMY_SPEED = 1
# 子弹
BULLET_IMAGE_NAME = "./resources/images/bullet/bullet.png"
BULLET_RECT = Rect(0, 0, 5, 5)
BULLET_SPEED = 5
# 0表示空白、1表示红墙、2表示铁墙、3表示草、4表示海、5表示鸟
RED_WALL = 1
IRON_WALL = 2
WEED_WALL = 3
BOSS_WALL = 5
WALLS = [
f"resources/images/walls/{file}" for file in os.listdir("resources/images/walls/")
]
# 爆炸的图片
BOOMS = [
"resources/images/boom/" + file for file in os.listdir("resources/images/boom")
]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。