碰撞修改

This commit is contained in:
星外之神 2022-05-07 15:23:36 +08:00
parent 4cf625c3f4
commit 4444ec2fa8
2 changed files with 3 additions and 2 deletions

View File

@ -621,7 +621,7 @@ class PotatoMine(Plant):
self.is_init = False
def canAttack(self, zombie):
if (pg.sprite.collide_circle_ratio(0.6)(zombie, self) and
if (pg.sprite.collide_circle_ratio(0.55)(zombie, self) and
(not self.is_init) and (not zombie.lostHead)):
return True
return False

View File

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