From 6bc813ce8e175a859e6525dced90e3fc660c8be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Sat, 14 May 2022 23:36:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=80=AD=E7=93=9C=E6=94=B9=E4=B8=BA=E5=8F=8C?= =?UTF-8?q?=E7=A2=B0=E6=92=9E=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/component/plant.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/source/component/plant.py b/source/component/plant.py index 748d675..8a8cfc5 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -780,18 +780,7 @@ class Squash(Plant): return True # 攻击状态 elif (self.state == c.ATTACK): - # 位置检测 - # 僵尸在倭瓜右侧 - if zombie.rect.x >= self.rect.x: - # 重叠15%判断为可以攻击 - if (self.rect.right - zombie.rect.left >= 20): - return True - # 僵尸在倭瓜右侧 - else: - if (zombie.rect.right - self.rect.left >= 20): - return True - # 碰撞检测 - if pg.sprite.collide_mask(zombie, self): + if pg.sprite.collide_rect_ratio(0.5)(zombie, self) or pg.sprite.collide_mask(zombie, self): return True return False