diff --git a/resources/data/map/level_0.json b/resources/data/map/level_0.json index f574436..58007dd 100644 --- a/resources/data/map/level_0.json +++ b/resources/data/map/level_0.json @@ -1,5 +1,5 @@ { - "background_type":1, + "background_type":2, "init_sun_value":5000, "shovel":1, "spawn_zombies":"list", diff --git a/resources/graphics/Bullets/Fume/Fume_0.png b/resources/graphics/Bullets/Fume/Fume_0.png new file mode 100644 index 0000000..121a123 Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_0.png differ diff --git a/resources/graphics/Bullets/Fume/Fume_1.png b/resources/graphics/Bullets/Fume/Fume_1.png new file mode 100644 index 0000000..e095513 Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_1.png differ diff --git a/resources/graphics/Bullets/Fume/Fume_2.png b/resources/graphics/Bullets/Fume/Fume_2.png new file mode 100644 index 0000000..6a11ea0 Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_2.png differ diff --git a/resources/graphics/Bullets/Fume/Fume_3.png b/resources/graphics/Bullets/Fume/Fume_3.png new file mode 100644 index 0000000..23b5a62 Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_3.png differ diff --git a/resources/graphics/Bullets/Fume/Fume_4.png b/resources/graphics/Bullets/Fume/Fume_4.png new file mode 100644 index 0000000..a0fa37a Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_4.png differ diff --git a/resources/graphics/Bullets/Fume/Fume_5.png b/resources/graphics/Bullets/Fume/Fume_5.png new file mode 100644 index 0000000..de5c903 Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_5.png differ diff --git a/resources/graphics/Bullets/Fume/Fume_6.png b/resources/graphics/Bullets/Fume/Fume_6.png new file mode 100644 index 0000000..2d544fc Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_6.png differ diff --git a/resources/graphics/Bullets/Fume/Fume_7.png b/resources/graphics/Bullets/Fume/Fume_7.png new file mode 100644 index 0000000..043a108 Binary files /dev/null and b/resources/graphics/Bullets/Fume/Fume_7.png differ diff --git a/resources/graphics/Cards/card_fumeshroom.png b/resources/graphics/Cards/card_fumeshroom.png new file mode 100644 index 0000000..bdf1bf0 Binary files /dev/null and b/resources/graphics/Cards/card_fumeshroom.png differ diff --git a/resources/graphics/Zombies/Zomboni/Zomboni/Zomboni_12.png b/resources/graphics/Zombies/Zomboni/Zomboni/Zomboni_0.png similarity index 100% rename from resources/graphics/Zombies/Zomboni/Zomboni/Zomboni_12.png rename to resources/graphics/Zombies/Zomboni/Zomboni/Zomboni_0.png diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_0.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_0.png new file mode 100644 index 0000000..af67ff7 Binary files /dev/null and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_0.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_1.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_1.png index af67ff7..662f59b 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_1.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_1.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_10.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_10.png index 91b9924..f6d817f 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_10.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_10.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_11.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_11.png index f6d817f..d2009d1 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_11.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_11.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_12.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_12.png index d2009d1..2c137ae 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_12.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_12.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_13.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_13.png index 2c137ae..19eb4e5 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_13.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_13.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_14.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_14.png index 19eb4e5..3d90fcb 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_14.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_14.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_15.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_15.png index 3d90fcb..73f289d 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_15.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_15.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_16.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_16.png deleted file mode 100644 index 73f289d..0000000 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_16.png and /dev/null differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_2.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_2.png index 662f59b..649bb49 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_2.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_2.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_3.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_3.png index 649bb49..0f58d8e 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_3.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_3.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_4.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_4.png index 0f58d8e..c8f4a70 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_4.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_4.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_5.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_5.png index c8f4a70..3b813b0 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_5.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_5.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_6.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_6.png index 3b813b0..bcc0f67 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_6.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_6.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_7.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_7.png index bcc0f67..a1460ef 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_7.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_7.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_8.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_8.png index a1460ef..170de93 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_8.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_8.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_9.png b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_9.png index 170de93..91b9924 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_9.png and b/resources/graphics/Zombies/Zomboni/ZomboniBoomDie/ZomboniBoomDie_9.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDamaged1/ZomboniDamaged1_11.png b/resources/graphics/Zombies/Zomboni/ZomboniDamaged1/ZomboniDamaged1_0.png similarity index 100% rename from resources/graphics/Zombies/Zomboni/ZomboniDamaged1/ZomboniDamaged1_11.png rename to resources/graphics/Zombies/Zomboni/ZomboniDamaged1/ZomboniDamaged1_0.png diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDamaged2/ZomboniDamaged2_11.png b/resources/graphics/Zombies/Zomboni/ZomboniDamaged2/ZomboniDamaged2_0.png similarity index 100% rename from resources/graphics/Zombies/Zomboni/ZomboniDamaged2/ZomboniDamaged2_11.png rename to resources/graphics/Zombies/Zomboni/ZomboniDamaged2/ZomboniDamaged2_0.png diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_0.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_0.png new file mode 100644 index 0000000..9b0acfc Binary files /dev/null and b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_0.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_1.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_1.png index 9b0acfc..141be4f 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_1.png and b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_1.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_2.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_2.png index 141be4f..9d4b35b 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_2.png and b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_2.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_3.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_3.png index 9d4b35b..abbcc90 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_3.png and b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_3.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_4.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_4.png index abbcc90..2910fb5 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_4.png and b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_4.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_5.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_5.png index 2910fb5..b97df3a 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_5.png and b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_5.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_6.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_6.png index b97df3a..902c485 100644 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_6.png and b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_6.png differ diff --git a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_7.png b/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_7.png deleted file mode 100644 index 902c485..0000000 Binary files a/resources/graphics/Zombies/Zomboni/ZomboniDie/ZomboniDie_7.png and /dev/null differ diff --git a/source/component/plant.py b/source/component/plant.py index 856d2fb..9ad775a 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -278,8 +278,8 @@ class Plant(pg.sprite.Sprite): if not zombie.lostHead: self.health -= damage self.hit_timer = self.current_time - if (self.health == 0) or (self.name == c.HYPNOSHROOM and self.state != c.SLEEP): # 魅惑菇触发同样会消失 - self.kill_zombie = zombie + if (self.name == c.HYPNOSHROOM) and (self.state != c.SLEEP) and (zombie.name not in {"投石车僵尸(未实现)"}): + self.zombie_to_hypno = zombie def getPosition(self): return self.rect.centerx, self.rect.bottom @@ -344,7 +344,7 @@ class PeaShooter(Plant): self.shoot_timer = 0 def attacking(self): - if (self.current_time - self.shoot_timer) > 1400: + if (self.current_time - self.shoot_timer) >= 1400: self.bullet_group.add(Bullet(self.rect.right - 15, self.rect.y, self.rect.y, c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=False)) self.shoot_timer = self.current_time @@ -361,7 +361,7 @@ class RepeaterPea(Plant): self.firstShot = False def attacking(self): - if (self.current_time - self.shoot_timer > 1400): + if (self.current_time - self.shoot_timer >= 1400): self.firstShot = True self.bullet_group.add(Bullet(self.rect.right - 15, self.rect.y, self.rect.y, c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=False)) @@ -385,7 +385,7 @@ class ThreePeaShooter(Plant): self.background_type = background_type def attacking(self): - if (self.current_time - self.shoot_timer) > 1400: + if (self.current_time - self.shoot_timer) >= 1400: offset_y = 9 # modify bullet in the same y position with bullets of other plants for i in range(3): tmp_y = self.map_y + (i - 1) @@ -408,7 +408,7 @@ class SnowPeaShooter(Plant): self.shoot_timer = 0 def attacking(self): - if (self.current_time - self.shoot_timer) > 1400: + if (self.current_time - self.shoot_timer) >= 1400: self.bullet_group.add(Bullet(self.rect.right - 15, self.rect.y, self.rect.y, c.BULLET_PEA_ICE, c.BULLET_DAMAGE_NORMAL, effect=c.BULLET_EFFECT_ICE)) self.shoot_timer = self.current_time @@ -574,7 +574,7 @@ class PuffShroom(Plant): self.frames = self.idle_frames def attacking(self): - if (self.current_time - self.shoot_timer) > 1400: + if (self.current_time - self.shoot_timer) >= 1400: self.bullet_group.add(Bullet(self.rect.right, self.rect.y + 10, self.rect.y + 10, c.BULLET_MUSHROOM, c.BULLET_DAMAGE_NORMAL, effect=False)) self.shoot_timer = self.current_time @@ -731,7 +731,7 @@ class Spikeweed(Plant): self.state = c.ATTACK def attacking(self): - if (self.current_time - self.attack_timer) > 700: + if (self.current_time - self.attack_timer) >= 700: self.attack_timer = self.current_time for zombie in self.zombie_group: if self.canAttack(zombie): @@ -828,7 +828,7 @@ class ScaredyShroom(Plant): self.changeFrames(self.idle_frames) def attacking(self): - if (self.current_time - self.shoot_timer) > 1400: + if (self.current_time - self.shoot_timer) >= 1400: self.bullet_group.add(Bullet(self.rect.right - 15, self.rect.y + 40, self.rect.y + 40, c.BULLET_MUSHROOM, c.BULLET_DAMAGE_NORMAL, effect=False)) self.shoot_timer = self.current_time @@ -945,6 +945,7 @@ class HypnoShroom(Plant): Plant.__init__(self, x, y, c.HYPNOSHROOM, c.PLANT_HEALTH, None) self.can_sleep = True self.animate_interval = 80 + self.zombie_to_hypno = None def loadImages(self, name, scale): self.idle_frames = [] @@ -962,8 +963,7 @@ class HypnoShroom(Plant): self.frames = self.idle_frames def idling(self): - # 现在没有投石车僵尸,所以暂时这样处理 - if self.health < c.PLANT_HEALTH: + if self.health < c.PLANT_HEALTH and self.zombie_to_hypno: self.health = 0 @@ -1161,7 +1161,7 @@ class StarFruit(Plant): return False def attacking(self): - if (self.current_time - self.shoot_timer) > 1400: + if (self.current_time - self.shoot_timer) >= 1400: self.bullet_group.add(StarBullet(self.rect.left - 10, self.rect.y + 15, c.BULLET_DAMAGE_NORMAL, c.STAR_BACKWARD, self.level)) self.bullet_group.add(StarBullet(self.rect.centerx - 20, self.rect.bottom - self.rect.h - 15, c.BULLET_DAMAGE_NORMAL, c.STAR_UPWARD, self.level)) self.bullet_group.add(StarBullet(self.rect.centerx - 20, self.rect.bottom - 5, c.BULLET_DAMAGE_NORMAL, c.STAR_DOWNWARD, self.level)) @@ -1219,7 +1219,7 @@ class SeaShroom(Plant): self.frames = self.idle_frames def attacking(self): - if (self.current_time - self.shoot_timer) > 1400: + if (self.current_time - self.shoot_timer) >= 1400: self.bullet_group.add(Bullet(self.rect.right, self.rect.y + 50, self.rect.y + 50, c.BULLET_SEASHROOM, c.BULLET_DAMAGE_NORMAL, effect=False)) self.shoot_timer = self.current_time @@ -1474,3 +1474,32 @@ class GraveBuster(Plant): self.image.set_alpha(192) else: self.image.set_alpha(255) + +class FumeShroom(Plant): + def __init__(self, x, y, bullet_group): + Plant.__init__(self, x, y, c.FUMESHROOM, c.PLANT_HEALTH, bullet_group) + self.can_sleep = True + self.shoot_timer = 0 + + def loadImages(self, name, scale): + self.idle_frames = [] + self.sleep_frames = [] + self.attack_frames = [] + + idle_name = name + sleep_name = name + 'Sleep' + attack_name = name + 'Attack' + + frame_list = [self.idle_frames, self.sleep_frames, self.attack_frames] + name_list = [idle_name, sleep_name, attack_name] + + for i, name in enumerate(name_list): + self.loadFrames(frame_list[i], name, 1, c.WHITE) + + self.frames = self.idle_frames + + def canAttack(self, zombie): + if (self.rect.x <= zombie.rect.right and + (self.rect.x + c.GRID_X_SIZE * 4.5 >= zombie.rect.x) and (zombie.rect.left <= c.SCREEN_WIDTH + 10)): + return True + return False \ No newline at end of file diff --git a/source/constants.py b/source/constants.py index 92204ce..43943a2 100755 --- a/source/constants.py +++ b/source/constants.py @@ -1,5 +1,5 @@ # 冒险模式起始关卡 -START_LEVEL_NUM = 1 +START_LEVEL_NUM = 0 # 小游戏模式起始关卡 START_LITTLE_GAME_NUM = 1 @@ -216,6 +216,7 @@ ICE_FROZEN_PLOT = 'IceFrozenPlot' HOLE = 'Hole' GRAVE = 'Grave' GRAVEBUSTER = 'GraveBuster' +FUMESHROOM = 'FumeShroom' # 植物生命值 @@ -268,6 +269,7 @@ CARD_TALLNUT = 'card_tallnut' CARD_TANGLEKLEP = 'card_tangleklep' CARD_DOOMSHROOM = 'card_doomshroom' CARD_GRAVEBUSTER = 'card_gravebuster' +CARD_FUMESHROOM = 'card_fumeshroom' # 子弹信息 # 子弹类型 diff --git a/source/state/level.py b/source/state/level.py index 4ced7f8..aa88871 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1149,7 +1149,7 @@ class Level(tool.State): elif targetPlant.name == c.ICESHROOM and targetPlant.state != c.SLEEP: self.freezeZombies(targetPlant) elif targetPlant.name == c.HYPNOSHROOM and targetPlant.state != c.SLEEP: - zombie = targetPlant.kill_zombie + zombie = targetPlant.zombie_to_hypno zombie.setHypno() _, map_y = self.map.getMapIndex(zombie.rect.centerx, zombie.rect.bottom) self.zombie_groups[map_y].remove(zombie)