更改飞出屏幕对象的杀死条件

This commit is contained in:
星外之神 2022-06-04 21:31:09 +08:00
parent 1ff2d1a6f6
commit 0db90ba8c8

View File

@ -207,7 +207,7 @@ class StarBullet(Bullet):
else: else:
self.rect.x -= 10 self.rect.x -= 10
self.handleMapYPosition() self.handleMapYPosition()
if ((self.rect.x > c.SCREEN_WIDTH + 60) or (self.rect.x < -40) if ((self.rect.x > c.SCREEN_WIDTH + 60) or (self.rect.x < -60)
or (self.rect.y > c.SCREEN_HEIGHT) or (self.rect.y < 0)): or (self.rect.y > c.SCREEN_HEIGHT) or (self.rect.y < 0)):
self.kill() self.kill()
elif self.state == c.EXPLODE: elif self.state == c.EXPLODE:
@ -1161,7 +1161,7 @@ class WallNutBowling(Plant):
self.handleMapYPosition() self.handleMapYPosition()
if self.shouldChangeDirection(): if self.shouldChangeDirection():
self.changeDirection(-1) self.changeDirection(-1)
if self.init_rect.x > c.SCREEN_WIDTH: if self.init_rect.x > c.SCREEN_WIDTH + 60:
self.health = 0 self.health = 0
self.move_timer += self.move_interval self.move_timer += self.move_interval
@ -1253,7 +1253,7 @@ class RedWallNutBowling(Plant):
elif (self.current_time - self.move_timer) >= self.move_interval: elif (self.current_time - self.move_timer) >= self.move_interval:
self.rotate_degree = (self.rotate_degree - 30) % 360 self.rotate_degree = (self.rotate_degree - 30) % 360
self.init_rect.x += self.vel_x self.init_rect.x += self.vel_x
if self.init_rect.x > c.SCREEN_WIDTH: if self.init_rect.x > c.SCREEN_WIDTH + 60:
self.health = 0 self.health = 0
self.move_timer += self.move_interval self.move_timer += self.move_interval