加入铁门僵尸

This commit is contained in:
星外之神 2022-05-05 11:53:34 +08:00
parent a0234e81c7
commit a4d778f5fc
34 changed files with 47 additions and 4 deletions

View File

@ -5,7 +5,7 @@
**本项目为个人python语言学习的练习项目仅供个人学习和研究使用不得用于其他用途。如果这个游戏侵犯了版权请联系我删除**
* 已有的植物:向日葵,豌豆射手,坚果墙,寒冰射手,樱桃炸弹,三线射手,大嘴花,小喷菇,土豆雷,地刺,胆小菇,倭瓜,火爆辣椒,阳光菇,寒冰菇,魅惑菇,火炬树桩,睡莲,杨桃,咖啡豆,海蘑菇
* 已有的僵尸:普通僵尸,旗帜僵尸,路障僵尸,铁桶僵尸,读报僵尸,橄榄球僵尸,鸭子救生圈僵尸
* 已有的僵尸:普通僵尸,旗帜僵尸,路障僵尸,铁桶僵尸,读报僵尸,橄榄球僵尸,鸭子救生圈僵尸,铁门僵尸
* 使用 JSON 文件记录关卡信息数据
* 支持选择植物卡片
* 支持白昼模式,夜晚模式,泳池模式,传送带模式和坚果保龄球模式

View File

@ -31,6 +31,8 @@
"ConeheadDukyTubeZombieSwim":{"x":55, "width":105},
"BucketheadDukyTubeZombie":{"x":55, "width":105},
"BucketheadDukyTubeZombieAttack":{"x":55, "width":105},
"BucketheadDukyTubeZombieSwim":{"x":55, "width":105}
"BucketheadDukyTubeZombieSwim":{"x":55, "width":105},
"ScreenDoorZombie":{"x":41, "width":100},
"ScreenDoorZombieAttack":{"x":41, "width":100}
}
}

View File

@ -4,7 +4,7 @@
"shovel":1,
"spawn_zombies":"list",
"zombie_list":[
{"time":0, "map_y":3, "name":"BucketheadDuckyTubeZombie"},
{"time":0, "map_y":4, "name":"ScreenDoorZombie"},
{"time":0, "map_y":2, "name":"ConeheadDuckyTubeZombie"},
{"time":60000, "map_y":2, "name":"Zombie"}
]

View File

@ -3,7 +3,7 @@
"init_sun_value":50,
"shovel":1,
"spawn_zombies":"auto",
"included_zombies":["Zombie", "ConeheadZombie", "BucketheadZombie"],
"included_zombies":["Zombie", "ConeheadZombie", "BucketheadZombie", "ScreenDoorZombie"],
"inevitable_zombie_list":{"20":["BucketheadZombie"]},
"num_flags":3
}

View File

@ -774,3 +774,39 @@ class BucketHeadDuckyTubeZombie(Zombie):
self.loadFrames(frame_list[i], name)
self.frames = self.helmet_walk_frames
class ScreenDoorZombie(Zombie):
def __init__(self, x, y, head_group):
Zombie.__init__(self, x, y, c.SCREEN_DOOR_ZOMBIE, head_group, helmetType2Health=c.SCREEN_DOOR_HEALTH)
def loadImages(self):
self.helmet_walk_frames = []
self.helmet_attack_frames = []
self.walk_frames = []
self.attack_frames = []
self.losthead_walk_frames = []
self.losthead_attack_frames = []
self.die_frames = []
self.boomdie_frames = []
helmet_walk_name = self.name
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'
boomdie_name = c.BOOMDIE
frame_list = [self.helmet_walk_frames, self.helmet_attack_frames,
self.walk_frames, self.attack_frames, self.losthead_walk_frames,
self.losthead_attack_frames, self.die_frames, self.boomdie_frames]
name_list = [helmet_walk_name, helmet_attack_name,
walk_name, attack_name, losthead_walk_name,
losthead_attack_name, die_name, boomdie_name]
for i, name in enumerate(name_list):
self.loadFrames(frame_list[i], name)
self.frames = self.helmet_walk_frames

View File

@ -288,6 +288,7 @@ FOOTBALL_ZOMBIE = 'FootballZombie'
DUCKY_TUBE_ZOMBIE = 'DuckyTubeZombie'
CONEHEAD_DUCKY_TUBE_ZOMBIE = 'ConeheadDuckyTubeZombie'
BUCKETHEAD_DUCKY_TUBE_ZOMBIE = 'BucketheadDuckyTubeZombie'
SCREEN_DOOR_ZOMBIE = 'ScreenDoorZombie'
BOOMDIE = 'BoomDie'
@ -309,6 +310,7 @@ BUCKETHEAD_HEALTH = 1100
FOOTBALL_HELMET_HEALTH = 1400
# 有关二类防具
NEWSPAPER_HEALTH = 150
SCREEN_DOOR_HEALTH = 1100
# 僵尸行动信息
ATTACK_INTERVAL = 500

View File

@ -330,6 +330,7 @@ class Level(tool.State):
c.DUCKY_TUBE_ZOMBIE:(1, 0), # 作为变种,不主动生成
c.CONEHEAD_DUCKY_TUBE_ZOMBIE:(2, 0), # 作为变种,不主动生成
c.BUCKETHEAD_DUCKY_TUBE_ZOMBIE:(4, 0), # 作为变种,不主动生成
c.SCREEN_DOOR_ZOMBIE:(4, 3500),
}
# 将僵尸与水上变种对应
self.convertZombieInPool = {c.NORMAL_ZOMBIE:c.DUCKY_TUBE_ZOMBIE,
@ -685,6 +686,8 @@ class Level(tool.State):
self.zombie_groups[map_y].add(zombie.ConeHeadDuckyTubeZombie(c.ZOMBIE_START_X + 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 + 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 + randint(-20, 20) + hugeWaveMove, y, self.head_group))
# 能否种植物的判断:
# 先判断位置是否合法 isValid(map_x, map_y)