From 05d7ad2adb79a9bacc2022b4888441d8367c1d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Fri, 6 May 2022 13:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E5=B8=B8=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/component/plant.py | 1 - source/state/level.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/component/plant.py b/source/component/plant.py index da75834..ad858e5 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -592,7 +592,6 @@ class PotatoMine(Plant): self.is_init = True self.init_timer = 0 self.bomb_timer = 0 - self.explode_y_range = 0 self.explode_x_range = c.GRID_X_SIZE def loadImages(self, name, scale): diff --git a/source/state/level.py b/source/state/level.py index 5409db0..2e3987e 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1012,7 +1012,7 @@ 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 ((abs(zombie.rect.centerx - x) <= plant.explode_y_range) or + if ((abs(zombie.rect.centerx - x) <= plant.explode_x_range) or ((zombie.rect.right - (x-plant.explode_x_range) > 20) or (zombie.rect.right - (x-plant.explode_x_range))/zombie.rect.width > 0.2, ((x+plant.explode_x_range) - zombie.rect.left > 20) or ((x+plant.explode_x_range) - zombie.rect.left)/zombie.rect.width > 0.2)[zombie.rect.x > x]): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[0]是在左边的情况,[1]是在右边的情况 zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE) else: