将车改为按行绘制;豌豆通过火炬树桩继承之前的移动轨迹
This commit is contained in:
parent
ada7d690eb
commit
3a53f772ce
@ -17,6 +17,6 @@
|
||||
{"time":0, "map_y":0, "name":"PoleVaultingZombie"},
|
||||
{"time":6000, "map_y":0, "name":"FootballZombie"},
|
||||
{"time":0, "map_y":2, "name":"ConeheadDuckyTubeZombie"},
|
||||
{"time":80000, "map_y":2, "name":"ConeheadDuckyTubeZombie"}
|
||||
{"time":90000, "map_y":2, "name":"ConeheadDuckyTubeZombie"}
|
||||
]
|
||||
}
|
||||
@ -340,7 +340,9 @@ class Plant(pg.sprite.Sprite):
|
||||
if not zombie.lostHead:
|
||||
self.health -= damage
|
||||
self.hit_timer = self.current_time
|
||||
if (self.name == c.HYPNOSHROOM) and (self.state != c.SLEEP) and (zombie.name not in {"投石车僵尸(未实现)"}):
|
||||
if ((self.name == c.HYPNOSHROOM) and
|
||||
(self.state != c.SLEEP) and
|
||||
(zombie.name not in {c.ZOMBONI, "投石车僵尸(未实现)", "加刚特尔(未实现)"})):
|
||||
self.zombie_to_hypno = zombie
|
||||
|
||||
def getPosition(self):
|
||||
@ -1254,13 +1256,13 @@ class TorchWood(Plant):
|
||||
if i.name == c.BULLET_PEA:
|
||||
if i.passedTorchWood != self.rect.centerx:
|
||||
if abs(i.rect.centerx - self.rect.centerx) <= 20:
|
||||
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.rect.y,
|
||||
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.dest_y,
|
||||
c.BULLET_FIREBALL, c.BULLET_DAMAGE_FIREBALL_BODY, effect=c.BULLET_EFFECT_UNICE, passedTorchWood=self.rect.centerx))
|
||||
i.kill()
|
||||
elif i.name == c.BULLET_PEA_ICE:
|
||||
if i.passedTorchWood != self.rect.centerx:
|
||||
if abs(i.rect.centerx - self.rect.centerx) <= 20:
|
||||
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.rect.y,
|
||||
self.bullet_group.add(Bullet(i.rect.x, i.rect.y, i.dest_y,
|
||||
c.BULLET_PEA, c.BULLET_DAMAGE_NORMAL, effect=None, passedTorchWood=self.rect.centerx))
|
||||
i.kill()
|
||||
|
||||
|
||||
@ -1001,7 +1001,7 @@ class Zomboni(Zombie):
|
||||
if ((plant.name not in {c.SPIKEWEED})
|
||||
and (self.rect.centerx <= plant.rect.right <= self.rect.right)):
|
||||
# 扣除生命值为可能的最大有限生命值
|
||||
plant.setDamage(8000, self)
|
||||
plant.health -= 8000
|
||||
|
||||
# 造冰
|
||||
mapX, mapY = self.map.getMapIndex(self.rect.right - 20, self.rect.bottom)
|
||||
|
||||
@ -771,6 +771,7 @@ class Level(tool.State):
|
||||
self.shovelRemovePlant(mouse_pos)
|
||||
|
||||
for car in self.cars:
|
||||
if car:
|
||||
car.update(self.game_info)
|
||||
|
||||
self.menubar.update(self.current_time)
|
||||
@ -1154,15 +1155,16 @@ class Level(tool.State):
|
||||
self.newPlantAndPositon = None # 生效后需要解除刷新设置
|
||||
|
||||
def checkCarCollisions(self):
|
||||
for car in self.cars:
|
||||
for zombie in self.zombie_groups[car.map_y]:
|
||||
for i in range(len(self.cars)):
|
||||
if self.cars[i]:
|
||||
for zombie in self.zombie_groups[i]:
|
||||
if zombie and zombie.state != c.DIE and (not zombie.lostHead) and (zombie.rect.centerx <= 0):
|
||||
car.setWalk()
|
||||
if zombie.rect.centerx <= car.rect.x:
|
||||
self.cars[i].setWalk()
|
||||
if zombie.rect.centerx <= self.cars[i].rect.x:
|
||||
zombie.health = 0
|
||||
zombie.kill()
|
||||
if car.dead:
|
||||
self.cars.remove(car)
|
||||
if self.cars[i].dead:
|
||||
self.cars[i] = None
|
||||
|
||||
def boomZombies(self, x, map_y, y_range, x_range, effect=None):
|
||||
for i in range(self.map_y_len):
|
||||
@ -1217,6 +1219,7 @@ class Level(tool.State):
|
||||
elif targetPlant.name == c.ICESHROOM and targetPlant.state != c.SLEEP:
|
||||
self.freezeZombies(targetPlant)
|
||||
elif targetPlant.name == c.HYPNOSHROOM and targetPlant.state != c.SLEEP:
|
||||
if targetPlant.zombie_to_hypno:
|
||||
zombie = targetPlant.zombie_to_hypno
|
||||
zombie.setHypno()
|
||||
_, map_y = self.map.getMapIndex(zombie.rect.centerx, zombie.rect.bottom)
|
||||
@ -1488,14 +1491,14 @@ class Level(tool.State):
|
||||
surface.blit(self.little_menu, self.little_menu_rect)
|
||||
|
||||
self.menubar.draw(surface)
|
||||
for car in self.cars:
|
||||
car.draw(surface)
|
||||
for i in range(self.map_y_len):
|
||||
self.plant_groups[i].draw(surface)
|
||||
self.zombie_groups[i].draw(surface)
|
||||
self.hypno_zombie_groups[i].draw(surface)
|
||||
self.bullet_groups[i].draw(surface)
|
||||
self.drawZombieFreezeTrap(i, surface)
|
||||
if self.cars[i]:
|
||||
self.cars[i].draw(surface)
|
||||
self.head_group.draw(surface)
|
||||
self.sun_group.draw(surface)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user