From ce51eb084532b2fc05e4db2c071279ffc766b10c Mon Sep 17 00:00:00 2001 From: Frank DeMarco Date: Tue, 2 Jan 2018 20:51:42 -0500 Subject: [PATCH] end --- NS.py | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/NS.py b/NS.py index e88b478..16a6d94 100644 --- a/NS.py +++ b/NS.py @@ -70,6 +70,7 @@ class NS(Game, Animation): self.background.fill((0, 0, 0)) self.title = Title(self) self.introduction = Introduction(self) + self.ending = Ending(self) self.wipe = Wipe(self) self.platform = Platform(self) self.dialogue = Dialogue(self) @@ -91,6 +92,7 @@ class NS(Game, Animation): if not leave_wipe_running: self.wipe.reset() self.introduction.reset() + self.ending.reset() self.boss.reset() self.chemtrails.reset() self.platform.reset() @@ -128,6 +130,7 @@ class NS(Game, Animation): Animation.update(self) self.title.update() self.introduction.update() + self.ending.update() self.boss.update() if not self.introduction.active: self.platform.update() @@ -395,7 +398,7 @@ class Introduction(Animation): def activate_boss(self): self.deactivate() - self.get_game().boss.start_level(0) + self.get_game().boss.start_level(2) def start_wipe(self): self.get_game().wipe.start(self.activate_boss) @@ -1286,10 +1289,16 @@ class Boss(Animation): def transition_to_battle(self): index = self.level_index + (not self.player_defeated) - if self.kills < 3 and index < 3: + if self.kills >= 3: + self.get_game().reset(True) + elif index < 3: self.start_level(index) else: - self.get_game().reset(True) + game = self.get_game() + game.boss.reset() + game.chemtrails.reset() + game.platform.reset() + game.ending.activate() def transition_to_title(self): self.get_game().reset(True) @@ -1457,3 +1466,72 @@ class Health(GameChild): surface = self.bar.copy() surface.blit(mask, (0, 0), None, BLEND_RGBA_MIN) self.get_display_surface().blit(surface, self.BAR_POSITION) + + +class Ending(Animation): + + TEXT = "Wow! You vanquished all the goons and skated like a pro, slime bag.\n" + \ + "You made your father proud today. I love you, child.", + + def __init__(self, parent): + Animation.__init__(self, parent) + self.tony = load(self.get_resource("Big_Tony.png")).convert() + self.slime_bag = Sprite(self) + self.slime_bag.load_from_path(self.get_resource("Introduction_slime_bag.png"), True) + self.slime_bag.location.center = self.get_display_surface().get_rect().center + self.tony_avatar = load(self.get_resource("Introduction_tony_avatar.png")).convert() + self.advance_prompt = AdvancePrompt(self) + self.register(self.start) + + def reset(self): + self.deactivate() + self.slime_bag.unhide() + self.halt() + self.text_index = 0 + self.advance_prompt.reset() + + def deactivate(self): + self.active = False + + def activate(self): + self.active = True + self.play(self.start, delay=3000, play_once=True) + + def start(self): + self.advance_prompt.cancel_first_press() + dialogue = self.get_game().dialogue + dialogue.activate() + dialogue.set_avatar(self.tony_avatar) + dialogue.set_name("Tony") + dialogue.show_text(self.TEXT[0]) + self.text_index = 0 + + def end_game(self): + self.deactivate() + self.get_game().reset(True) + + def start_wipe(self): + self.get_game().wipe.start(self.end_game) + + def update(self): + if self.active: + Animation.update(self) + dialogue = self.get_game().dialogue + wipe = self.get_game().wipe + if not wipe.is_playing() and not self.is_playing(self.start) and not self.text_index == 2: + if self.advance_prompt.check_first_press(): + self.advance_prompt.press_first() + elif self.advance_prompt.check_second_press(): + if dialogue.is_playing(): + dialogue.show_all() + else: + if self.text_index < len(self.TEXT) - 1: + pass + else: + self.start_wipe() + self.advance_prompt.cancel_first_press() + self.get_display_surface().blit(self.tony, (0, 0)) + self.slime_bag.update() + self.get_game().dialogue.update() + if not wipe.is_playing() and not self.is_playing(self.start): + self.advance_prompt.update()