attack and damage sound effects

This commit is contained in:
frank 2022-03-01 16:27:09 -05:00
parent e1ab123bdd
commit 5e941dbd5b
5 changed files with 19 additions and 1 deletions

18
NS.py
View File

@ -1701,6 +1701,14 @@ class Boss(Animation):
frame = background.frames[0].copy() frame = background.frames[0].copy()
frame.fill((0, 150, 150), None, pygame.BLEND_RGB_SUB) frame.fill((0, 150, 150), None, pygame.BLEND_RGB_SUB)
background.add_frame(frame) background.add_frame(frame)
# Shining background
background.add_frameset(name="shining", switch=True, framerate=120)
for hue in range(0, 360, 40):
frame = background.frames[0].copy()
color = Color(0, 0, 0)
color.hsla = hue, 30, 30, 100
frame.fill(color, None, pygame.BLEND_RGB_ADD)
background.add_frame(frame)
background.set_frameset("normal") background.set_frameset("normal")
self.countdown = Countdown(self) self.countdown = Countdown(self)
# Set the alien's arm to its own sprite # Set the alien's arm to its own sprite
@ -1785,7 +1793,7 @@ class Boss(Animation):
dialogue.set_avatar(self.visitor_avatar) dialogue.set_avatar(self.visitor_avatar)
dialogue.set_name("Visitor") dialogue.set_name("Visitor")
self.visitor.hide() self.visitor.hide()
self.play(self.enter_boss, play_once=True, delay=2000) self.play(self.enter_boss, play_once=True, delay=1500)
elif index == 2: elif index == 2:
dialogue.set_avatar(self.spoopy_avatar) dialogue.set_avatar(self.spoopy_avatar)
dialogue.set_name("Spoopy") dialogue.set_name("Spoopy")
@ -1796,6 +1804,8 @@ class Boss(Animation):
self.get_game().platform.activate() self.get_game().platform.activate()
self.get_game().chemtrails.activate() self.get_game().chemtrails.activate()
self.last_attack = NS.NW self.last_attack = NS.NW
self.backgrounds[self.level_index].set_frameset("normal")
self.halt(self.flash_player_damage)
def show_introduction_dialogue(self): def show_introduction_dialogue(self):
dialogue = self.get_game().dialogue dialogue = self.get_game().dialogue
@ -2039,6 +2049,9 @@ class Boss(Animation):
elif self.level_index == 2: elif self.level_index == 2:
self.spoopy.set_frameset(0) self.spoopy.set_frameset(0)
self.add_score() self.add_score()
self.backgrounds[self.level_index].set_frameset("shining")
else:
self.play(self.flash_player_damage)
self.player_defeated = not win self.player_defeated = not win
self.kills += not win self.kills += not win
self.play(self.show_end_dialogue, delay=3000, play_once=True) self.play(self.show_end_dialogue, delay=3000, play_once=True)
@ -2050,6 +2063,7 @@ class Boss(Animation):
def show_end_dialogue(self): def show_end_dialogue(self):
dialogue = self.get_game().dialogue dialogue = self.get_game().dialogue
dialogue.activate() dialogue.activate()
self.get_audio().play_sfx("die")
if self.level_index == 0: if self.level_index == 0:
if self.player_defeated: if self.player_defeated:
dialogue.show_text("Maybe next time!") dialogue.show_text("Maybe next time!")
@ -2483,10 +2497,12 @@ class Sword(Animation):
if self.attacking_player and ii == self.active_sprite_index: if self.attacking_player and ii == self.active_sprite_index:
sprite.hide() sprite.hide()
self.get_game().boss.start_player_damage() self.get_game().boss.start_player_damage()
self.get_audio().play_sfx("damage", x=sprite.location.centerx)
else: else:
center_save = sprite.location.center center_save = sprite.location.center
sprite.set_frameset("explode") sprite.set_frameset("explode")
sprite.location.center = center_save sprite.location.center = center_save
self.get_audio().play_sfx("explode", x=sprite.location.centerx)
if self.parent.level_index == 1: if self.parent.level_index == 1:
if self.parent.is_playing(self.parent.end_hit_animation, include_delay=True): if self.parent.is_playing(self.parent.end_hit_animation, include_delay=True):
self.parent.halt(self.parent.end_hit_animation) self.parent.halt(self.parent.end_hit_animation)

View File

@ -12,3 +12,5 @@
54614 54614
52434 52434
168209 168209
141407
139786

BIN
resource/sfx/damage.wav Normal file

Binary file not shown.

BIN
resource/sfx/die.wav Normal file

Binary file not shown.

BIN
resource/sfx/explode.wav Normal file

Binary file not shown.