优化音效

This commit is contained in:
星外之神 2022-05-06 18:13:37 +08:00
parent 62976366c1
commit 4f9df6de38
2 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ class StarBullet(Bullet):
else:
self.rect.x -= 10
self.handleMapYPosition()
if ((self.rect.x > c.SCREEN_WIDTH) or (self.rect.x < 0)
if ((self.rect.x > c.SCREEN_WIDTH) or (self.rect.x < -20)
or (self.rect.y > c.SCREEN_HEIGHT) or (self.rect.y < 0)):
self.kill()
elif self.state == c.EXPLODE:

View File

@ -1018,7 +1018,7 @@ class Level(tool.State):
if ((abs(zombie.rect.centerx - x) <= plant.explode_x_range) or
((zombie.rect.right - (x-plant.explode_x_range) > 20) or (zombie.rect.right - (x-plant.explode_x_range))/zombie.rect.width > 0.2, ((x+plant.explode_x_range) - zombie.rect.left > 20) or ((x+plant.explode_x_range) - zombie.rect.left)/zombie.rect.width > 0.2)[zombie.rect.x > x]): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[0]是在左边的情况,[1]是在右边的情况
zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE)
else:
elif plant.name != c.WALLNUTBOWLING:
# 触发植物死亡音效
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "plantDie.ogg")).play()
else: