end
This commit is contained in:
parent
6510026050
commit
ce51eb0845
84
NS.py
84
NS.py
|
@ -70,6 +70,7 @@ class NS(Game, Animation):
|
||||||
self.background.fill((0, 0, 0))
|
self.background.fill((0, 0, 0))
|
||||||
self.title = Title(self)
|
self.title = Title(self)
|
||||||
self.introduction = Introduction(self)
|
self.introduction = Introduction(self)
|
||||||
|
self.ending = Ending(self)
|
||||||
self.wipe = Wipe(self)
|
self.wipe = Wipe(self)
|
||||||
self.platform = Platform(self)
|
self.platform = Platform(self)
|
||||||
self.dialogue = Dialogue(self)
|
self.dialogue = Dialogue(self)
|
||||||
|
@ -91,6 +92,7 @@ class NS(Game, Animation):
|
||||||
if not leave_wipe_running:
|
if not leave_wipe_running:
|
||||||
self.wipe.reset()
|
self.wipe.reset()
|
||||||
self.introduction.reset()
|
self.introduction.reset()
|
||||||
|
self.ending.reset()
|
||||||
self.boss.reset()
|
self.boss.reset()
|
||||||
self.chemtrails.reset()
|
self.chemtrails.reset()
|
||||||
self.platform.reset()
|
self.platform.reset()
|
||||||
|
@ -128,6 +130,7 @@ class NS(Game, Animation):
|
||||||
Animation.update(self)
|
Animation.update(self)
|
||||||
self.title.update()
|
self.title.update()
|
||||||
self.introduction.update()
|
self.introduction.update()
|
||||||
|
self.ending.update()
|
||||||
self.boss.update()
|
self.boss.update()
|
||||||
if not self.introduction.active:
|
if not self.introduction.active:
|
||||||
self.platform.update()
|
self.platform.update()
|
||||||
|
@ -395,7 +398,7 @@ class Introduction(Animation):
|
||||||
|
|
||||||
def activate_boss(self):
|
def activate_boss(self):
|
||||||
self.deactivate()
|
self.deactivate()
|
||||||
self.get_game().boss.start_level(0)
|
self.get_game().boss.start_level(2)
|
||||||
|
|
||||||
def start_wipe(self):
|
def start_wipe(self):
|
||||||
self.get_game().wipe.start(self.activate_boss)
|
self.get_game().wipe.start(self.activate_boss)
|
||||||
|
@ -1286,10 +1289,16 @@ class Boss(Animation):
|
||||||
|
|
||||||
def transition_to_battle(self):
|
def transition_to_battle(self):
|
||||||
index = self.level_index + (not self.player_defeated)
|
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)
|
self.start_level(index)
|
||||||
else:
|
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):
|
def transition_to_title(self):
|
||||||
self.get_game().reset(True)
|
self.get_game().reset(True)
|
||||||
|
@ -1457,3 +1466,72 @@ class Health(GameChild):
|
||||||
surface = self.bar.copy()
|
surface = self.bar.copy()
|
||||||
surface.blit(mask, (0, 0), None, BLEND_RGBA_MIN)
|
surface.blit(mask, (0, 0), None, BLEND_RGBA_MIN)
|
||||||
self.get_display_surface().blit(surface, self.BAR_POSITION)
|
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()
|
||||||
|
|
Loading…
Reference in New Issue