From ce62e9b35c68d7d47b97f3e32f1c76b9eb7a4fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Tue, 2 Aug 2022 13:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=B0=8F=E6=8E=A8=E8=BD=A6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/component/plant.py | 2 +- source/state/level.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/component/plant.py b/source/component/plant.py index 4ce1e5f..e6e8dd0 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -22,7 +22,7 @@ class Car(pg.sprite.Sprite): def update(self, game_info): self.current_time = game_info[c.CURRENT_TIME] if self.state == c.WALK: - self.rect.x += 6 + self.rect.x += 5 if self.rect.x > c.SCREEN_WIDTH + 25: self.dead = True diff --git a/source/state/level.py b/source/state/level.py index 91c4647..84b31ee 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1182,7 +1182,8 @@ class Level(tool.State): if (zombie and zombie.state != c.DIE and (not zombie.losthead) and (pg.sprite.collide_mask(zombie, self.cars[i]))): self.cars[i].setWalk() - if pg.sprite.collide_mask(zombie, self.cars[i]): + if (pg.sprite.collide_mask(zombie, self.cars[i]) or + self.cars[i].rect.x <= zombie.rect.centerx <= self.cars[i].rect.right): zombie.health = 0 if self.cars[i].dead: self.cars[i] = None