From 87dfd57d6889dae103637066a4a00693178b21f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Tue, 5 Apr 2022 16:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=95=B0=E6=8D=AE=E4=BB=A5?= =?UTF-8?q?=E8=B4=B4=E8=BF=91=E5=8E=9F=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/component/zombie.py | 16 +++++++++------- source/constants.py | 34 ++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/source/component/zombie.py b/source/component/zombie.py index f3b83d9..0f05c89 100755 --- a/source/component/zombie.py +++ b/source/component/zombie.py @@ -5,7 +5,7 @@ from .. import constants as c class Zombie(pg.sprite.Sprite): - def __init__(self, x, y, name, health, head_group=None, damage=1): + def __init__(self, x, y, name, head_group=None, helmetHealth=0, bodyHealth=c.NORMAL_HEALTH + c.LOSTHEAD_HEALTH, damage=30): pg.sprite.Sprite.__init__(self) self.name = name @@ -19,7 +19,9 @@ class Zombie(pg.sprite.Sprite): self.rect.centerx = x self.rect.bottom = y - self.health = health + self.bodyHealth = bodyHealth + self.helmetHealth = helmetHealth + self.health = bodyHealth + helmetHealth self.damage = damage self.dead = False self.lostHead = False @@ -250,7 +252,7 @@ class ZombieHead(Zombie): class NormalZombie(Zombie): def __init__(self, x, y, head_group): - Zombie.__init__(self, x, y, c.NORMAL_ZOMBIE, c.NORMAL_HEALTH, head_group) + Zombie.__init__(self, x, y, c.NORMAL_ZOMBIE, head_group) def loadImages(self): self.walk_frames = [] @@ -280,7 +282,7 @@ class NormalZombie(Zombie): # 路障僵尸 class ConeHeadZombie(Zombie): def __init__(self, x, y, head_group): - Zombie.__init__(self, x, y, c.CONEHEAD_ZOMBIE, c.CONEHEAD_HEALTH, head_group) + Zombie.__init__(self, x, y, c.CONEHEAD_ZOMBIE, head_group, c.CONEHEAD_HEALTH) self.helmet = True def loadImages(self): @@ -317,7 +319,7 @@ class ConeHeadZombie(Zombie): class BucketHeadZombie(Zombie): def __init__(self, x, y, head_group): - Zombie.__init__(self, x, y, c.BUCKETHEAD_ZOMBIE, c.BUCKETHEAD_HEALTH, head_group) + Zombie.__init__(self, x, y, c.BUCKETHEAD_ZOMBIE, head_group, c.BUCKETHEAD_HEALTH) self.helmet = True def loadImages(self): @@ -354,7 +356,7 @@ class BucketHeadZombie(Zombie): class FlagZombie(Zombie): def __init__(self, x, y, head_group): - Zombie.__init__(self, x, y, c.FLAG_ZOMBIE, c.FLAG_HEALTH, head_group) + Zombie.__init__(self, x, y, c.FLAG_ZOMBIE, head_group, c.FLAG_HEALTH) def loadImages(self): self.walk_frames = [] @@ -384,7 +386,7 @@ class FlagZombie(Zombie): class NewspaperZombie(Zombie): def __init__(self, x, y, head_group): - Zombie.__init__(self, x, y, c.NEWSPAPER_ZOMBIE, c.NEWSPAPER_HEALTH, head_group) + Zombie.__init__(self, x, y, c.NEWSPAPER_ZOMBIE, head_group, c.NEWSPAPER_HEALTH) self.helmet = True def loadImages(self): diff --git a/source/constants.py b/source/constants.py index 4cd1da9..f726b0b 100755 --- a/source/constants.py +++ b/source/constants.py @@ -109,15 +109,15 @@ HYPNOSHROOM = 'HypnoShroom' WALLNUTBOWLING = 'WallNutBowling' REDWALLNUTBOWLING = 'RedWallNutBowling' -PLANT_HEALTH = 5 -WALLNUT_HEALTH = 30 -WALLNUT_CRACKED1_HEALTH = 20 -WALLNUT_CRACKED2_HEALTH = 10 -WALLNUT_BOWLING_DAMAGE = 10 +PLANT_HEALTH = 300 +WALLNUT_HEALTH = 4000 +WALLNUT_CRACKED1_HEALTH = 4000//3 * 2 +WALLNUT_CRACKED2_HEALTH = 4000//3 +WALLNUT_BOWLING_DAMAGE = 370 PRODUCE_SUN_INTERVAL = 7000 -FLOWER_SUN_INTERVAL = 22000 -SUN_LIVE_TIME = 7000 +FLOWER_SUN_INTERVAL = 24000 +SUN_LIVE_TIME = 10000 SUN_VALUE = 25 ICE_SLOW_TIME = 10000 @@ -149,7 +149,7 @@ CARD_REDWALLNUT = 'card_redwallnut' BULLET_PEA = 'PeaNormal' BULLET_PEA_ICE = 'PeaIce' BULLET_MUSHROOM = 'BulletMushRoom' -BULLET_DAMAGE_NORMAL = 1 +BULLET_DAMAGE_NORMAL = 20 #ZOMBIE INFO ZOMBIE_IMAGE_RECT = 'zombie_image_rect' @@ -161,15 +161,17 @@ FLAG_ZOMBIE = 'FlagZombie' NEWSPAPER_ZOMBIE = 'NewspaperZombie' BOOMDIE = 'BoomDie' -LOSTHEAD_HEALTH = 2 -NORMAL_HEALTH = 10 -FLAG_HEALTH = 15 -CONEHEAD_HEALTH = 20 -BUCKETHEAD_HEALTH = 30 -NEWSPAPER_HEALTH = 15 +# 僵尸生命值设置 +LOSTHEAD_HEALTH = 70 +NORMAL_HEALTH = 200 # 普通僵尸生命值 -ATTACK_INTERVAL = 1000 -ZOMBIE_WALK_INTERVAL = 70 +FLAG_HEALTH = 50 +CONEHEAD_HEALTH = 370 +BUCKETHEAD_HEALTH = 1100 +NEWSPAPER_HEALTH = 200 + +ATTACK_INTERVAL = 500 +ZOMBIE_WALK_INTERVAL = 100 ZOMBIE_START_X = SCREEN_WIDTH + 50