forked from IronSpiderMan/TankWar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
86 lines (74 loc) · 2.75 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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")
]