From 7049309d6bb4a2424aad6b844fd377c3a521764b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Wed, 4 May 2022 22:55:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=83=86=E5=B0=8F=E8=8F=87?= =?UTF-8?q?=E8=AE=BE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/component/plant.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/component/plant.py b/source/component/plant.py index 55f1e2d..fd9aea7 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -802,7 +802,7 @@ class ScaredyShroom(Plant): Plant.__init__(self, x, y, c.SCAREDYSHROOM, c.PLANT_HEALTH, bullet_group) self.can_sleep = True self.shoot_timer = 0 - self.cry_x_range = c.GRID_X_SIZE * 2 + self.cry_x_range = c.GRID_X_SIZE * 1.5 def loadImages(self, name, scale): self.idle_frames = [] @@ -822,8 +822,7 @@ class ScaredyShroom(Plant): self.frames = self.idle_frames def needCry(self, zombie): - if (zombie.state != c.DIE and self.rect.x <= zombie.rect.right and - self.rect.x + self.cry_x_range > zombie.rect.x): + if (zombie.state != c.DIE and abs(self.rect.x - zombie.rect.x) < self.cry_x_range): return True return False