diff --git a/resources/data/map/level_0.json b/resources/data/map/level_0.json index 58007dd..d2c8986 100644 --- a/resources/data/map/level_0.json +++ b/resources/data/map/level_0.json @@ -14,6 +14,7 @@ {"time":7000, "map_y":4, "name":"ScreenDoorZombie"}, {"time":8000, "map_y":4, "name":"ScreenDoorZombie"}, {"time":0, "map_y":1, "name":"NewspaperZombie"}, + {"time":0, "map_y":0, "name":"PoleVaultingZombie"}, {"time":0, "map_y":2, "name":"ConeheadDuckyTubeZombie"}, {"time":80000, "map_y":2, "name":"ConeheadDuckyTubeZombie"} ] diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_0.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_0.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_0.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_0.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_1.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_1.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_1.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_1.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_10.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_10.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_10.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_10.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_11.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_11.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_11.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_11.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_12.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_12.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_12.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_12.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_13.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_13.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_13.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_13.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_14.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_14.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_14.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_14.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_15.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_15.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_15.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_15.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_16.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_16.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_16.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_16.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_17.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_17.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_17.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_17.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_18.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_18.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_18.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_18.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_19.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_19.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_19.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_19.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_2.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_2.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_2.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_2.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_20.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_20.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_20.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_20.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_21.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_21.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_21.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_21.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_22.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_22.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_22.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_22.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_23.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_23.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_23.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_23.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_24.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_24.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_24.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_24.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_25.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_25.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_25.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_25.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_3.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_3.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_3.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_3.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_4.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_4.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_4.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_4.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_5.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_5.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_5.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_5.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_6.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_6.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_6.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_6.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_7.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_7.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_7.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_7.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_8.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_8.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_8.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_8.png diff --git a/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_9.png b/resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_9.png similarity index 100% rename from resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalk/PoleVaultingZombieWalk_9.png rename to resources/graphics/Zombies/PoleVaultingZombie/PoleVaultingZombieWalkAfterJump/PoleVaultingZombieWalkAfterJump_9.png diff --git a/source/component/zombie.py b/source/component/zombie.py index 8c46850..a4394fb 100755 --- a/source/component/zombie.py +++ b/source/component/zombie.py @@ -138,17 +138,25 @@ class Zombie(pg.sprite.Sprite): if self.swimming: self.changeFrames(self.walk_frames) 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.helmetHealth <= 0: self.helmet = False - else: - self.changeFrames(self.helmet_walk_frames) + self.changeFrames(self.walk_frames) if self.helmetType2: if self.helmetType2Health <= 0: self.helmetType2 = False - else: - self.changeFrames(self.helmet_walk_frames) + self.changeFrames(self.walk_frames) elif self.is_hypno and self.rect.right > c.MAP_POOL_FRONT_X + 55: # 常数拟合暂时缺乏检验 if self.swimming: self.changeFrames(self.walk_frames) @@ -835,4 +843,45 @@ class ScreenDoorZombie(Zombie): for i, name in enumerate(name_list): self.loadFrames(frame_list[i], name) - self.frames = self.helmet_walk_frames \ No newline at end of file + 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) \ No newline at end of file diff --git a/source/constants.py b/source/constants.py index 5f479c0..87357ae 100755 --- a/source/constants.py +++ b/source/constants.py @@ -311,6 +311,7 @@ DUCKY_TUBE_ZOMBIE = 'DuckyTubeZombie' CONEHEAD_DUCKY_TUBE_ZOMBIE = 'ConeheadDuckyTubeZombie' BUCKETHEAD_DUCKY_TUBE_ZOMBIE = 'BucketheadDuckyTubeZombie' SCREEN_DOOR_ZOMBIE = 'ScreenDoorZombie' +POLE_VAULTING_ZOMBIE = 'PoleVaultingZombie' BOOMDIE = 'BoomDie' @@ -326,6 +327,7 @@ ZOMBIE_WALLNUT_BOWLING_DANMAGE = 'wallnutBowlingDamage' # 坚果保龄球冲撞 # 有关本体 LOSTHEAD_HEALTH = 70 NORMAL_HEALTH = 200 # 普通僵尸生命值 +POLE_VAULTING_HEALTH = 333 # 有关一类防具 CONEHEAD_HEALTH = 370 BUCKETHEAD_HEALTH = 1100 diff --git a/source/state/level.py b/source/state/level.py index b001d28..3fd6181 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -311,7 +311,7 @@ class Level(tool.State): self.cars = [] for i in range(self.map_y_len): _, 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): @@ -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)) 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)) + 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) @@ -1063,6 +1066,11 @@ class Level(tool.State): targetPlant = None if targetPlant: + # 撑杆跳的特殊情况 + if zombie.name == c.POLE_VAULTING_ZOMBIE and (not zombie.jumped): + zombie.setJump() + continue + if targetPlant.name == c.WALLNUTBOWLING: if targetPlant.canHit(i): zombie.setDamage(c.WALLNUT_BOWLING_DAMAGE, damageType=c.ZOMBIE_WALLNUT_BOWLING_DANMAGE) @@ -1096,9 +1104,9 @@ class Level(tool.State): def checkCarCollisions(self): for car in self.cars: 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() - if zombie.rect.x <= car.rect.x: + if zombie.rect.centerx <= car.rect.x: zombie.health = 0 zombie.kill() if car.dead: @@ -1307,7 +1315,7 @@ class Level(tool.State): def checkLose(self): for i in range(self.map_y_len): 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 False