增加僵尸啃咬连续性

This commit is contained in:
wszqkzqk 2022-05-03 14:10:27 +08:00
parent 8fd178cf47
commit e66f2307cf
2 changed files with 4 additions and 3 deletions

View File

@ -4,7 +4,7 @@ from .. import constants as c
class Zombie(pg.sprite.Sprite):
def __init__(self, x, y, name, head_group=None, helmetHealth=0, helmetType2Health=0, bodyHealth=c.NORMAL_HEALTH + c.LOSTHEAD_HEALTH, damage=30):
def __init__(self, x, y, name, head_group=None, helmetHealth=0, helmetType2Health=0, bodyHealth=c.NORMAL_HEALTH + c.LOSTHEAD_HEALTH, damage=c.ZOMBIE_ATTACK_DAMAGE):
pg.sprite.Sprite.__init__(self)
self.name = name
@ -123,7 +123,7 @@ class Zombie(pg.sprite.Sprite):
self.helmetType2 = False
if self.name == c.NEWSPAPER_ZOMBIE:
self.speed = 2.5
if ((self.current_time - self.attack_timer) > (c.ATTACK_INTERVAL * self.getAttackTimeRatio())) and not self.lostHead:
if ((self.current_time - self.attack_timer) > (c.ATTACK_INTERVAL * self.getAttackTimeRatio())) and (not self.lostHead):
if self.prey.health > 0:
if self.prey_is_plant:
self.prey.setDamage(self.damage, self)

View File

@ -299,7 +299,8 @@ FOOTBALL_HELMET_HEALTH = 1400
NEWSPAPER_HEALTH = 150
# 僵尸行动信息
ATTACK_INTERVAL = 500
ATTACK_INTERVAL = 250
ZOMBIE_ATTACK_DAMAGE = 15
ZOMBIE_WALK_INTERVAL = 60 # 僵尸步行间隔
# 僵尸生成位置