基本实现鸭子救生圈僵尸
This commit is contained in:
parent
94f8329803
commit
bf6a81885e
@ -4,7 +4,7 @@
|
||||
"shovel":1,
|
||||
"spawn_zombies":"list",
|
||||
"zombie_list":[
|
||||
{"time":1000, "map_y":2, "name":"DuckyTubeZombie"},
|
||||
{"time":0, "map_y":3, "name":"DuckyTubeZombie"},
|
||||
{"time":60000, "map_y":2, "name":"Zombie"}
|
||||
]
|
||||
}
|
||||
@ -24,6 +24,8 @@ class Zombie(pg.sprite.Sprite):
|
||||
self.damage = damage
|
||||
self.dead = False
|
||||
self.lostHead = False
|
||||
self.canSwim = canSwim
|
||||
self.swimming = False
|
||||
self.helmet = (self.helmetHealth > 0)
|
||||
self.helmetType2 = (self.helmetType2Health > 0)
|
||||
self.head_group = head_group
|
||||
@ -104,6 +106,13 @@ class Zombie(pg.sprite.Sprite):
|
||||
if self.name == c.NEWSPAPER_ZOMBIE:
|
||||
self.speed = 2.5
|
||||
|
||||
if self.canSwim:
|
||||
if self.rect.right <= c.MAP_POOL_FRONT_X:
|
||||
if not self.swimming:
|
||||
self.changeFrames(self.swim_frames)
|
||||
self.swimming = True
|
||||
# 待写带有盔甲的水生僵尸丢盔甲的判断
|
||||
|
||||
if (self.current_time - self.walk_timer) > (c.ZOMBIE_WALK_INTERVAL * self.getTimeRatio()):
|
||||
self.walk_timer = self.current_time
|
||||
if self.is_hypno:
|
||||
@ -305,6 +314,12 @@ class Zombie(pg.sprite.Sprite):
|
||||
else:
|
||||
self.changeFrames(self.walk_frames)
|
||||
|
||||
if self.canSwim:
|
||||
if self.rect.right <= c.MAP_POOL_FRONT_X:
|
||||
self.changeFrames(self.swim_frames)
|
||||
self.swimming = True
|
||||
# 待写带有盔甲的水生僵尸丢盔甲的判断
|
||||
|
||||
def setAttack(self, prey, is_plant=True):
|
||||
self.prey = prey # prey can be plant or other zombies
|
||||
self.prey_is_plant = is_plant
|
||||
|
||||
@ -142,7 +142,7 @@ MAP_ROOF_OFFSET_X = 35 # 暂时还不清楚数据
|
||||
MAP_ROOF_OFFSET_Y = 105 # 暂时还不清楚数据
|
||||
|
||||
# 泳池前端陆地部分
|
||||
MAP_POOL_FRONT_X = 770
|
||||
MAP_POOL_FRONT_X = SCREEN_WIDTH - 15
|
||||
|
||||
# 植物选择菜单栏、传送带菜单栏等类型设定
|
||||
CHOOSEBAR_TYPE = 'choosebar_type'
|
||||
|
||||
@ -833,6 +833,8 @@ class Level(tool.State):
|
||||
if zombie.state != c.WALK:
|
||||
if not self.refreshZombieAttack:
|
||||
continue
|
||||
if zombie.canSwim and (not zombie.swimming):
|
||||
continue
|
||||
plant = pg.sprite.spritecollideany(zombie, self.plant_groups[i], collided_func)
|
||||
if plant:
|
||||
if plant.name == c.WALLNUTBOWLING:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user