更改小推车设定
@ -14,6 +14,7 @@
|
|||||||
{"time":7000, "map_y":4, "name":"ScreenDoorZombie"},
|
{"time":7000, "map_y":4, "name":"ScreenDoorZombie"},
|
||||||
{"time":8000, "map_y":4, "name":"ScreenDoorZombie"},
|
{"time":8000, "map_y":4, "name":"ScreenDoorZombie"},
|
||||||
{"time":0, "map_y":1, "name":"NewspaperZombie"},
|
{"time":0, "map_y":1, "name":"NewspaperZombie"},
|
||||||
|
{"time":0, "map_y":0, "name":"PoleVaultingZombie"},
|
||||||
{"time":0, "map_y":2, "name":"ConeheadDuckyTubeZombie"},
|
{"time":0, "map_y":2, "name":"ConeheadDuckyTubeZombie"},
|
||||||
{"time":80000, "map_y":2, "name":"ConeheadDuckyTubeZombie"}
|
{"time":80000, "map_y":2, "name":"ConeheadDuckyTubeZombie"}
|
||||||
]
|
]
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
@ -138,17 +138,25 @@ class Zombie(pg.sprite.Sprite):
|
|||||||
if self.swimming:
|
if self.swimming:
|
||||||
self.changeFrames(self.walk_frames)
|
self.changeFrames(self.walk_frames)
|
||||||
self.swimming = False
|
self.swimming = False
|
||||||
# 同样没有兼容双防具
|
# 同样没有兼容双防具
|
||||||
|
if self.helmet:
|
||||||
|
if self.helmetHealth <= 0:
|
||||||
|
self.helmet = False
|
||||||
|
else:
|
||||||
|
self.changeFrames(self.helmet_walk_frames)
|
||||||
|
if self.helmetType2:
|
||||||
|
if self.helmetType2Health <= 0:
|
||||||
|
self.helmetType2 = False
|
||||||
|
else:
|
||||||
|
self.changeFrames(self.helmet_walk_frames)
|
||||||
if self.helmet:
|
if self.helmet:
|
||||||
if self.helmetHealth <= 0:
|
if self.helmetHealth <= 0:
|
||||||
self.helmet = False
|
self.helmet = False
|
||||||
else:
|
self.changeFrames(self.walk_frames)
|
||||||
self.changeFrames(self.helmet_walk_frames)
|
|
||||||
if self.helmetType2:
|
if self.helmetType2:
|
||||||
if self.helmetType2Health <= 0:
|
if self.helmetType2Health <= 0:
|
||||||
self.helmetType2 = False
|
self.helmetType2 = False
|
||||||
else:
|
self.changeFrames(self.walk_frames)
|
||||||
self.changeFrames(self.helmet_walk_frames)
|
|
||||||
elif self.is_hypno and self.rect.right > c.MAP_POOL_FRONT_X + 55: # 常数拟合暂时缺乏检验
|
elif self.is_hypno and self.rect.right > c.MAP_POOL_FRONT_X + 55: # 常数拟合暂时缺乏检验
|
||||||
if self.swimming:
|
if self.swimming:
|
||||||
self.changeFrames(self.walk_frames)
|
self.changeFrames(self.walk_frames)
|
||||||
@ -836,3 +844,44 @@ class ScreenDoorZombie(Zombie):
|
|||||||
self.loadFrames(frame_list[i], name)
|
self.loadFrames(frame_list[i], name)
|
||||||
|
|
||||||
self.frames = self.helmet_walk_frames
|
self.frames = self.helmet_walk_frames
|
||||||
|
|
||||||
|
|
||||||
|
class PoleVaultingZombie(Zombie):
|
||||||
|
def __init__(self, x, y, head_group):
|
||||||
|
Zombie.__init__(self, x, y, c.POLE_VAULTING_ZOMBIE, head_group=head_group)
|
||||||
|
self.speed = 1.88
|
||||||
|
self.jumped = False
|
||||||
|
|
||||||
|
def loadImages(self):
|
||||||
|
self.walk_frames = []
|
||||||
|
self.attack_frames = []
|
||||||
|
self.losthead_walk_frames = []
|
||||||
|
self.losthead_attack_frames = []
|
||||||
|
self.die_frames = []
|
||||||
|
self.boomdie_frames = []
|
||||||
|
self.walk_after_jump_frames = []
|
||||||
|
self.jump_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'
|
||||||
|
boomdie_name = c.BOOMDIE
|
||||||
|
walk_after_jump_name = self.name + 'WalkAfterJump'
|
||||||
|
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,
|
||||||
|
self.walk_after_jump_frames, self.jump_frames]
|
||||||
|
name_list = [walk_name, attack_name, losthead_walk_name,
|
||||||
|
losthead_attack_name, die_name, boomdie_name,
|
||||||
|
walk_after_jump_name, jump_name]
|
||||||
|
|
||||||
|
for i, name in enumerate(name_list):
|
||||||
|
self.loadFrames(frame_list[i], name)
|
||||||
|
|
||||||
|
self.frames = self.walk_frames
|
||||||
|
|
||||||
|
def setJump(self):
|
||||||
|
self.changeFrames(self.jump_frames)
|
||||||
@ -311,6 +311,7 @@ DUCKY_TUBE_ZOMBIE = 'DuckyTubeZombie'
|
|||||||
CONEHEAD_DUCKY_TUBE_ZOMBIE = 'ConeheadDuckyTubeZombie'
|
CONEHEAD_DUCKY_TUBE_ZOMBIE = 'ConeheadDuckyTubeZombie'
|
||||||
BUCKETHEAD_DUCKY_TUBE_ZOMBIE = 'BucketheadDuckyTubeZombie'
|
BUCKETHEAD_DUCKY_TUBE_ZOMBIE = 'BucketheadDuckyTubeZombie'
|
||||||
SCREEN_DOOR_ZOMBIE = 'ScreenDoorZombie'
|
SCREEN_DOOR_ZOMBIE = 'ScreenDoorZombie'
|
||||||
|
POLE_VAULTING_ZOMBIE = 'PoleVaultingZombie'
|
||||||
|
|
||||||
BOOMDIE = 'BoomDie'
|
BOOMDIE = 'BoomDie'
|
||||||
|
|
||||||
@ -326,6 +327,7 @@ ZOMBIE_WALLNUT_BOWLING_DANMAGE = 'wallnutBowlingDamage' # 坚果保龄球冲撞
|
|||||||
# 有关本体
|
# 有关本体
|
||||||
LOSTHEAD_HEALTH = 70
|
LOSTHEAD_HEALTH = 70
|
||||||
NORMAL_HEALTH = 200 # 普通僵尸生命值
|
NORMAL_HEALTH = 200 # 普通僵尸生命值
|
||||||
|
POLE_VAULTING_HEALTH = 333
|
||||||
# 有关一类防具
|
# 有关一类防具
|
||||||
CONEHEAD_HEALTH = 370
|
CONEHEAD_HEALTH = 370
|
||||||
BUCKETHEAD_HEALTH = 1100
|
BUCKETHEAD_HEALTH = 1100
|
||||||
|
|||||||
@ -311,7 +311,7 @@ class Level(tool.State):
|
|||||||
self.cars = []
|
self.cars = []
|
||||||
for i in range(self.map_y_len):
|
for i in range(self.map_y_len):
|
||||||
_, y = self.map.getMapGridPos(0, i)
|
_, y = self.map.getMapGridPos(0, i)
|
||||||
self.cars.append(plant.Car(-25, y+20, i))
|
self.cars.append(plant.Car(-40, y+20, i))
|
||||||
|
|
||||||
# 更新函数每帧被调用,将鼠标事件传入给状态处理函数
|
# 更新函数每帧被调用,将鼠标事件传入给状态处理函数
|
||||||
def update(self, surface, current_time, mouse_pos, mouse_click):
|
def update(self, surface, current_time, mouse_pos, mouse_click):
|
||||||
@ -820,6 +820,9 @@ class Level(tool.State):
|
|||||||
self.zombie_groups[map_y].add(zombie.BucketHeadDuckyTubeZombie(c.ZOMBIE_START_X + randint(-20, 20) + hugeWaveMove, y, self.head_group))
|
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:
|
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))
|
self.zombie_groups[map_y].add(zombie.ScreenDoorZombie(c.ZOMBIE_START_X + randint(-20, 20) + hugeWaveMove, y, self.head_group))
|
||||||
|
elif name == c.POLE_VAULTING_ZOMBIE:
|
||||||
|
# 撑杆跳生成位置不同
|
||||||
|
self.zombie_groups[map_y].add(zombie.PoleVaultingZombie(c.ZOMBIE_START_X + randint(70, 80) + hugeWaveMove, y, self.head_group))
|
||||||
|
|
||||||
# 能否种植物的判断:
|
# 能否种植物的判断:
|
||||||
# 先判断位置是否合法 isValid(map_x, map_y)
|
# 先判断位置是否合法 isValid(map_x, map_y)
|
||||||
@ -1063,6 +1066,11 @@ class Level(tool.State):
|
|||||||
targetPlant = None
|
targetPlant = None
|
||||||
|
|
||||||
if targetPlant:
|
if targetPlant:
|
||||||
|
# 撑杆跳的特殊情况
|
||||||
|
if zombie.name == c.POLE_VAULTING_ZOMBIE and (not zombie.jumped):
|
||||||
|
zombie.setJump()
|
||||||
|
continue
|
||||||
|
|
||||||
if targetPlant.name == c.WALLNUTBOWLING:
|
if targetPlant.name == c.WALLNUTBOWLING:
|
||||||
if targetPlant.canHit(i):
|
if targetPlant.canHit(i):
|
||||||
zombie.setDamage(c.WALLNUT_BOWLING_DAMAGE, damageType=c.ZOMBIE_WALLNUT_BOWLING_DANMAGE)
|
zombie.setDamage(c.WALLNUT_BOWLING_DAMAGE, damageType=c.ZOMBIE_WALLNUT_BOWLING_DANMAGE)
|
||||||
@ -1096,9 +1104,9 @@ class Level(tool.State):
|
|||||||
def checkCarCollisions(self):
|
def checkCarCollisions(self):
|
||||||
for car in self.cars:
|
for car in self.cars:
|
||||||
for zombie in self.zombie_groups[car.map_y]:
|
for zombie in self.zombie_groups[car.map_y]:
|
||||||
if zombie and zombie.state != c.DIE and (not zombie.lostHead) and zombie.rect.x <= 0:
|
if zombie and zombie.state != c.DIE and (not zombie.lostHead) and zombie.rect.centerx <= 0:
|
||||||
car.setWalk()
|
car.setWalk()
|
||||||
if zombie.rect.x <= car.rect.x:
|
if zombie.rect.centerx <= car.rect.x:
|
||||||
zombie.health = 0
|
zombie.health = 0
|
||||||
zombie.kill()
|
zombie.kill()
|
||||||
if car.dead:
|
if car.dead:
|
||||||
@ -1307,7 +1315,7 @@ class Level(tool.State):
|
|||||||
def checkLose(self):
|
def checkLose(self):
|
||||||
for i in range(self.map_y_len):
|
for i in range(self.map_y_len):
|
||||||
for zombie in self.zombie_groups[i]:
|
for zombie in self.zombie_groups[i]:
|
||||||
if zombie.rect.right < -10 and (not zombie.lostHead):
|
if zombie.rect.right < -20 and (not zombie.lostHead) and zombie.state != c.DIE:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||