加入倭瓜碾压音效
This commit is contained in:
parent
f34e00c361
commit
5bc89e1b81
BIN
resources/sound/squashing.ogg
Normal file
BIN
resources/sound/squashing.ogg
Normal file
Binary file not shown.
@ -801,6 +801,8 @@ class Squash(Plant):
|
|||||||
self.health = 0 # 避免僵尸在原位啃食
|
self.health = 0 # 避免僵尸在原位啃食
|
||||||
self.mapPlantsSet.remove(c.SQUASH)
|
self.mapPlantsSet.remove(c.SQUASH)
|
||||||
self.kill()
|
self.kill()
|
||||||
|
# 播放碾压音效
|
||||||
|
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "squashing.ogg")).play()
|
||||||
elif self.aim_timer == 0:
|
elif self.aim_timer == 0:
|
||||||
# 锁定目标时播放音效
|
# 锁定目标时播放音效
|
||||||
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "squashHmm.ogg")).play()
|
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "squashHmm.ogg")).play()
|
||||||
|
|||||||
@ -1084,6 +1084,10 @@ class Level(tool.State):
|
|||||||
elif plant.name in {c.LILYPAD, "花盆(未实现)"}:
|
elif plant.name in {c.LILYPAD, "花盆(未实现)"}:
|
||||||
attackableBackupPlant.append(plant)
|
attackableBackupPlant.append(plant)
|
||||||
# 注意要剔除掉两个“假植物”,以及不能被啃的地刺
|
# 注意要剔除掉两个“假植物”,以及不能被啃的地刺
|
||||||
|
elif plant.name == c.SQUASH:
|
||||||
|
# 跳起后不得被啃食
|
||||||
|
if not plant.squashing:
|
||||||
|
attackableCommonPlants.append(plant)
|
||||||
elif plant.name not in {c.HOLE, c.ICE_FROZEN_PLOT, c.GRAVE, c.SPIKEWEED}:
|
elif plant.name not in {c.HOLE, c.ICE_FROZEN_PLOT, c.GRAVE, c.SPIKEWEED}:
|
||||||
attackableCommonPlants.append(plant)
|
attackableCommonPlants.append(plant)
|
||||||
else:
|
else:
|
||||||
@ -1280,7 +1284,7 @@ class Level(tool.State):
|
|||||||
for zombie in self.zombie_groups[i]:
|
for zombie in self.zombie_groups[i]:
|
||||||
# 双判断:发生碰撞或在攻击范围内
|
# 双判断:发生碰撞或在攻击范围内
|
||||||
if ((pg.sprite.collide_mask(zombie, targetPlant)) or
|
if ((pg.sprite.collide_mask(zombie, targetPlant)) or
|
||||||
(abs(zombie.rect.centerx - x) <= targetPlant.explode_x_range)):
|
(abs(zombie.rect.centerx - targetPlant.rect.centerx) <= targetPlant.explode_x_range)):
|
||||||
zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE)
|
zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE)
|
||||||
targetPlant.boomed = True
|
targetPlant.boomed = True
|
||||||
elif targetPlant.name == c.SQUASH:
|
elif targetPlant.name == c.SQUASH:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user