修复报纸被非灰烬植物秒杀后会触发加速的bug
This commit is contained in:
parent
81c8d3d3a5
commit
26e49297e5
@ -70,16 +70,20 @@ class Zombie(pg.sprite.Sprite):
|
|||||||
def checkToDie(self, framesKind):
|
def checkToDie(self, framesKind):
|
||||||
if self.health <= 0:
|
if self.health <= 0:
|
||||||
self.setDie()
|
self.setDie()
|
||||||
|
return True
|
||||||
elif self.health <= c.LOSTHEAD_HEALTH:
|
elif self.health <= c.LOSTHEAD_HEALTH:
|
||||||
if not self.lostHead:
|
if not self.lostHead:
|
||||||
self.changeFrames(framesKind)
|
self.changeFrames(framesKind)
|
||||||
self.setLostHead()
|
self.setLostHead()
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
self.health -= (self.current_time - self.losthead_timer) / 40
|
self.health -= (self.current_time - self.losthead_timer) / 40
|
||||||
self.losthead_timer = self.current_time
|
self.losthead_timer = self.current_time
|
||||||
|
return False
|
||||||
|
|
||||||
def walking(self):
|
def walking(self):
|
||||||
self.checkToDie(self.losthead_walk_frames)
|
if self.checkToDie(self.losthead_walk_frames):
|
||||||
|
return
|
||||||
|
|
||||||
if self.helmetHealth <= 0 and self.helmet:
|
if self.helmetHealth <= 0 and self.helmet:
|
||||||
self.changeFrames(self.walk_frames)
|
self.changeFrames(self.walk_frames)
|
||||||
@ -98,7 +102,8 @@ class Zombie(pg.sprite.Sprite):
|
|||||||
self.rect.x -= 1
|
self.rect.x -= 1
|
||||||
|
|
||||||
def attacking(self):
|
def attacking(self):
|
||||||
self.checkToDie(self.losthead_attack_frames)
|
if self.checkToDie(self.losthead_attack_frames):
|
||||||
|
return
|
||||||
|
|
||||||
if self.helmetHealth <= 0 and self.helmet:
|
if self.helmetHealth <= 0 and self.helmet:
|
||||||
self.changeFrames(self.attack_frames)
|
self.changeFrames(self.attack_frames)
|
||||||
@ -125,9 +130,11 @@ class Zombie(pg.sprite.Sprite):
|
|||||||
|
|
||||||
def freezing(self):
|
def freezing(self):
|
||||||
if self.old_state == c.WALK:
|
if self.old_state == c.WALK:
|
||||||
self.checkToDie(self.losthead_walk_frames)
|
if self.checkToDie(self.losthead_walk_frames):
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
self.checkToDie(self.losthead_attack_frames)
|
if self.checkToDie(self.losthead_attack_frames):
|
||||||
|
return
|
||||||
|
|
||||||
if (self.current_time - self.freeze_timer) > c.FREEZE_TIME:
|
if (self.current_time - self.freeze_timer) > c.FREEZE_TIME:
|
||||||
self.setWalk()
|
self.setWalk()
|
||||||
|
|||||||
@ -653,7 +653,7 @@ class Level(tool.State):
|
|||||||
continue
|
continue
|
||||||
for zombie in self.zombie_groups[i]:
|
for zombie in self.zombie_groups[i]:
|
||||||
if ((abs(zombie.rect.centerx - x) <= x_range) or
|
if ((abs(zombie.rect.centerx - x) <= x_range) or
|
||||||
((zombie.rect.right - (x-x_range) > 20) or (zombie.rect.right - (x-x_range))/zombie.rect.width > 0.15, ((x+x_range) - zombie.rect.left > 20) or ((x+x_range) - zombie.rect.left)/zombie.rect.width > 0.15)[zombie.rect.x > x]): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[0]是在左边的情况,[1]是在右边的情况
|
((zombie.rect.right - (x-x_range) > 20) or (zombie.rect.right - (x-x_range))/zombie.rect.width > 0.2, ((x+x_range) - zombie.rect.left > 20) or ((x+x_range) - zombie.rect.left)/zombie.rect.width > 0.2)[zombie.rect.x > x]): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[0]是在左边的情况,[1]是在右边的情况
|
||||||
zombie.setDamage(1800, damageType=c.ZOMBIE_ASH_DAMAGE)
|
zombie.setDamage(1800, damageType=c.ZOMBIE_ASH_DAMAGE)
|
||||||
if zombie.health <= 0:
|
if zombie.health <= 0:
|
||||||
zombie.setBoomDie()
|
zombie.setBoomDie()
|
||||||
@ -696,7 +696,7 @@ class Level(tool.State):
|
|||||||
continue
|
continue
|
||||||
for zombie in self.zombie_groups[i]:
|
for zombie in self.zombie_groups[i]:
|
||||||
if ((abs(zombie.rect.centerx - x) <= plant.explode_y_range) or
|
if ((abs(zombie.rect.centerx - x) <= plant.explode_y_range) or
|
||||||
((zombie.rect.right - (x-plant.explode_x_range) > 20) or (zombie.rect.right - (x-plant.explode_x_range))/zombie.rect.width > 0.15, ((x+plant.explode_x_range) - zombie.rect.left > 20) or ((x+plant.explode_x_range) - zombie.rect.left)/zombie.rect.width > 0.15)[zombie.rect.x > x]): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[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)
|
||||||
|
|
||||||
# 避免僵尸在用铲子移除植物后还在原位啃食
|
# 避免僵尸在用铲子移除植物后还在原位啃食
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user