完善小推车设置

This commit is contained in:
星外之神 2022-08-02 13:35:25 +08:00
parent 9fa8fbb847
commit ce62e9b35c
2 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,7 @@ class Car(pg.sprite.Sprite):
def update(self, game_info): def update(self, game_info):
self.current_time = game_info[c.CURRENT_TIME] self.current_time = game_info[c.CURRENT_TIME]
if self.state == c.WALK: if self.state == c.WALK:
self.rect.x += 6 self.rect.x += 5
if self.rect.x > c.SCREEN_WIDTH + 25: if self.rect.x > c.SCREEN_WIDTH + 25:
self.dead = True self.dead = True

View File

@ -1182,7 +1182,8 @@ class Level(tool.State):
if (zombie and zombie.state != c.DIE and (not zombie.losthead) if (zombie and zombie.state != c.DIE and (not zombie.losthead)
and (pg.sprite.collide_mask(zombie, self.cars[i]))): and (pg.sprite.collide_mask(zombie, self.cars[i]))):
self.cars[i].setWalk() 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 zombie.health = 0
if self.cars[i].dead: if self.cars[i].dead:
self.cars[i] = None self.cars[i] = None