diff --git a/source/component/plant.py b/source/component/plant.py index cc60678..90061de 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -621,7 +621,7 @@ class PotatoMine(Plant): self.is_init = False def canAttack(self, zombie): - if (pg.sprite.collide_circle_ratio(0.6)(zombie, self) and + if (pg.sprite.collide_circle_ratio(0.55)(zombie, self) and (not self.is_init) and (not zombie.lostHead)): return True return False diff --git a/source/state/level.py b/source/state/level.py index 72ffe80..b167df2 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1015,8 +1015,9 @@ class Level(tool.State): self.hypno_zombie_groups[map_y].add(zombie) elif (plant.name == c.POTATOMINE and not plant.is_init): # 土豆雷不是灰烬植物,不能用Boom for zombie in self.zombie_groups[map_y]: + # 双判断:发生碰撞或在攻击范围内 if ((pg.sprite.collide_circle_ratio(0.6)(zombie, plant)) or - (abs(zombie.rect.centerx - x) <= plant.explode_x_range)): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[0]是在左边的情况,[1]是在右边的情况 + (abs(zombie.rect.centerx - x) <= plant.explode_x_range)): zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE) elif plant.name != c.WALLNUTBOWLING: # 触发植物死亡音效