更改倭瓜音效播放时间

This commit is contained in:
星外之神 2022-05-06 10:40:37 +08:00
parent b96b3d9c11
commit d1e1c3757c

View File

@ -716,8 +716,6 @@ class Squash(Plant):
self.state = c.ATTACK self.state = c.ATTACK
# 攻击状态下生命值无敌 # 攻击状态下生命值无敌
self.health = float('inf') self.health = float('inf')
# 锁定目标时播放音效
pg.mixer.Sound(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))) ,"resources", "sound", "squashHmm.ogg")).play()
def attacking(self): def attacking(self):
if self.squashing: if self.squashing:
@ -729,6 +727,8 @@ class Squash(Plant):
self.mapPlantsSet.remove(c.SQUASH) self.mapPlantsSet.remove(c.SQUASH)
self.kill() self.kill()
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()
self.aim_timer = self.current_time self.aim_timer = self.current_time
self.changeFrames(self.aim_frames) self.changeFrames(self.aim_frames)
elif (self.current_time - self.aim_timer) > 1000: elif (self.current_time - self.aim_timer) > 1000: