diff --git a/resources/data/map/level_0.json b/resources/data/map/level_0.json index d2c8986..dc35859 100644 --- a/resources/data/map/level_0.json +++ b/resources/data/map/level_0.json @@ -14,7 +14,8 @@ {"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":3000, "map_y":0, "name":"PoleVaultingZombie"}, + {"time":0, "map_y":0, "name":"FootballZombie"}, {"time":0, "map_y":2, "name":"ConeheadDuckyTubeZombie"}, {"time":80000, "map_y":2, "name":"ConeheadDuckyTubeZombie"} ] diff --git a/resources/sound/polevaultjump.ogg b/resources/sound/polevaultjump.ogg new file mode 100644 index 0000000..4e28f18 Binary files /dev/null and b/resources/sound/polevaultjump.ogg differ diff --git a/source/component/plant.py b/source/component/plant.py index 24abab6..10c586e 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -511,10 +511,10 @@ class WallNut(Plant): self.loadFrames(self.cracked2_frames, cracked2_frames_name, 1) def idling(self): - if not self.cracked1 and self.health <= c.WALLNUT_CRACKED1_HEALTH: + if (not self.cracked1) and self.health <= c.WALLNUT_CRACKED1_HEALTH: self.changeFrames(self.cracked1_frames) self.cracked1 = True - elif not self.cracked2 and self.health <= c.WALLNUT_CRACKED2_HEALTH: + elif (not self.cracked2) and self.health <= c.WALLNUT_CRACKED2_HEALTH: self.changeFrames(self.cracked2_frames) self.cracked2 = True diff --git a/source/component/zombie.py b/source/component/zombie.py index 8670e6f..41f087e 100755 --- a/source/component/zombie.py +++ b/source/component/zombie.py @@ -884,11 +884,14 @@ class PoleVaultingZombie(Zombie): self.frames = self.walk_before_jump_frames - def setJump(self, successfullyJumped): + def setJump(self, successfullyJumped, jumpX): if not self.jumping: self.jumping = True self.changeFrames(self.jump_frames) self.successfullyJumped = successfullyJumped + self.jumpX = jumpX + # 播放跳跃音效 + pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "polevaultjump.ogg")).play() def animation(self): if self.state == c.FREEZE: @@ -898,7 +901,10 @@ class PoleVaultingZombie(Zombie): if (self.current_time - self.animate_timer) > (self.animate_interval * self.getTimeRatio()): self.frame_index += 1 if self.jumping and (not self.jumped): - self.rect.x -= 5 + if self.successfullyJumped: + self.rect.x -= 5 + else: + self.rect.x -= 1 if self.frame_index >= self.frame_num: if self.state == c.DIE: self.kill() @@ -907,7 +913,7 @@ class PoleVaultingZombie(Zombie): if self.jumping and (not self.jumped): self.changeFrames(self.walk_frames) if self.successfullyJumped: - self.rect.x -= c.GRID_X_SIZE * 1.3 + self.rect.centerx = self.jumpX self.jumped = True self.speed = 1.04 self.animate_timer = self.current_time diff --git a/source/constants.py b/source/constants.py index ba2605f..87357ae 100755 --- a/source/constants.py +++ b/source/constants.py @@ -166,7 +166,7 @@ PANEL_Y_INTERNAL = 73 PANEL_X_INTERNAL = 53 BAR_CARD_X_INTERNAL = 51 CARD_MAX_NUM = 10 # 这里以后可以增加解锁功能,从最初的6格逐渐解锁到10格 -CARD_LIST_NUM = 0#CARD_MAX_NUM +CARD_LIST_NUM = CARD_MAX_NUM # 所选植物信息索引 PLANT_NAME_INDEX = 0 diff --git a/source/state/level.py b/source/state/level.py index 0dac3cc..11ec572 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1070,10 +1070,11 @@ class Level(tool.State): # 撑杆跳的特殊情况 if zombie.name in {c.POLE_VAULTING_ZOMBIE} and (not zombie.jumped): map_x, map_y = self.map.getMapIndex(targetPlant.rect.centerx, targetPlant.rect.bottom) + jumpX = targetPlant.rect.x - c.GRID_X_SIZE * 0.7 if c.TALLNUT in self.map.map[map_y][map_x][c.MAP_PLANT]: - zombie.setJump(False) + zombie.setJump(False, jumpX) else: - zombie.setJump(True) + zombie.setJump(True, jumpX) continue if targetPlant.name == c.WALLNUTBOWLING: @@ -1279,7 +1280,7 @@ class Level(tool.State): if plant.canAttack(zombie): plant.setAttack(zombie, self.zombie_groups[i]) break - elif plant.name in {c.WALLNUTBOWLING, c.REDWALLNUTBOWLING}: + elif plant.name in {c.WALLNUTBOWLING, c.REDWALLNUTBOWLING, c.WALLNUT, c.TALLNUT}: pass else: can_attack = False