整理掉奇怪的代码

This commit is contained in:
星外之神 2022-05-06 19:06:22 +08:00
parent 640059eb47
commit 0f723f43d4

View File

@ -1016,8 +1016,7 @@ class Level(tool.State):
elif (plant.name == c.POTATOMINE and not plant.is_init): # 土豆雷不是灰烬植物不能用Boom elif (plant.name == c.POTATOMINE and not plant.is_init): # 土豆雷不是灰烬植物不能用Boom
for zombie in self.zombie_groups[map_y]: for zombie in self.zombie_groups[map_y]:
if ((pg.sprite.collide_circle_ratio(0.6)(zombie, plant)) or if ((pg.sprite.collide_circle_ratio(0.6)(zombie, plant)) or
(abs(zombie.rect.centerx - x) <= plant.explode_x_range) or (abs(zombie.rect.centerx - x) <= plant.explode_x_range)): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[0]是在左边的情况,[1]是在右边的情况
((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) zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE)
elif plant.name != c.WALLNUTBOWLING: elif plant.name != c.WALLNUTBOWLING:
# 触发植物死亡音效 # 触发植物死亡音效