removed buttons from dialog

This commit is contained in:
Frank DeMarco 2020-10-30 03:57:46 -04:00
parent 9b6d5e5af2
commit e40bd37be2
4 changed files with 66 additions and 39 deletions

98
NS.py
View File

@ -361,6 +361,12 @@ class Tony(Sprite):
elif name == "static":
self.board.hide()
def shift_frame(self):
Sprite.shift_frame(self)
frameset = self.get_current_frameset()
if frameset.name == "board" and frameset.current_index == 1:
self.get_audio().play_sfx("comeOn")
def update(self):
save = self.get_display_surface()
intermediate_surface = Surface(self.location.size, SRCALPHA)
@ -453,7 +459,7 @@ class Logo(Sprite):
class Title(Animation):
UNLOCK_MOVES = NS.N, NS.NW, NS.E, NS.S
UNLOCK_MOVES = NS.NW, NS.N, NS.NE, NS.NW
def __init__(self, parent):
Animation.__init__(self, parent)
@ -469,10 +475,10 @@ class Title(Animation):
self.show_video()
def reset(self):
# self.first_pressed = False
# self.first_pressed_elapsed = 0
self.unlock_index = 0
self.get_game().platform.set_glowing(self.get_game().platform.get_buttons_from_edges([self.UNLOCK_MOVES[0]]))
self.halt()
self.show_video()
def activate(self):
self.active = True
@ -529,7 +535,8 @@ class Title(Animation):
self.video.unhide()
self.play(self.hide_video, delay=self.get_configuration("time", "attract-gif-length"), play_once=True)
self.get_game().tony.set_frameset("static")
self.reset()
self.unlock_index = 0
self.get_game().platform.set_glowing(self.get_game().platform.get_buttons_from_edges([self.UNLOCK_MOVES[0]]))
def hide_video(self):
self.video.hide()
@ -924,23 +931,25 @@ class SkipPrompt(GameChild):
class AdvancePrompt(GameChild):
BUTTON_SIZE = 8
BUTTON_BORDER = 1
BUTTON_SPACING = 27
BUTTON_SIZE = 30
BUTTON_BORDER = 3
BUTTON_SPACING = 64
def __init__(self, parent):
GameChild.__init__(self, parent)
dsr = self.get_display_surface().get_rect()
self.buttons = Button(self, NS.N, self.BUTTON_SIZE, self.BUTTON_BORDER), \
Button(self, NS.NW, self.BUTTON_SIZE, self.BUTTON_BORDER)
self.buttons[1].location.bottomright = dsr.right - 3, dsr.bottom - 3
self.buttons[0].location.bottomright = (
self.buttons[1].location.right - self.buttons[0].location.w - self.BUTTON_SPACING,
self.buttons[1].location.bottom)
self.plus = Sprite(self)
self.plus.load_from_path(self.get_resource("Plus.png"), True)
self.plus.location.center = self.buttons[1].location.left - self.BUTTON_SPACING / 2, \
self.buttons[1].location.centery
dsr = self.get_display_surface().get_rect()
self.plus.location.center = dsr.centerx, dsr.centery + 70
self.buttons[1].location.center = self.plus.location.move(self.BUTTON_SPACING, 0).center
self.buttons[0].location.center = self.plus.location.move(-self.BUTTON_SPACING, 0).center
self.background_rect = Rect(
self.buttons[0].location.topleft,
(self.buttons[1].location.right - self.buttons[0].location.left, self.buttons[0].location.height))
self.background_rect.inflate_ip((10, 10))
def reset(self):
self.cancel_first_press()
@ -972,8 +981,7 @@ class AdvancePrompt(GameChild):
def update(self):
if self.first_pressed:
self.first_pressed_elapsed += self.get_game().time_filter.get_last_frame_duration()
# if self.first_pressed_elapsed > 4000:
# self.cancel_first_press()
self.get_display_surface().fill((255, 255, 255), self.background_rect)
for button in self.buttons:
button.update()
self.plus.update()
@ -1454,7 +1462,7 @@ class Boss(Animation):
self.health = Health(self)
self.sword = Sword(self)
self.register(self.brandish, self.cancel_flash, self.show_introduction_dialogue,
self.show_end_dialogue)
self.show_end_dialogue, self.end_dialogue)
self.kool_man.add_frameset([0], name="normal", switch=True)
self.visitor.add_frameset([0], name="normal", switch=True)
self.spoopy.add_frameset([0], name="normal", switch=True)
@ -1518,6 +1526,7 @@ class Boss(Animation):
elif self.level_index == 2:
dialogue.show_text("Lizard! My moves are so unpredictable you might as well" +
" give\nup now!")
self.play(self.end_dialogue, delay=5000, play_once=True)
def reset(self):
self.level_index = 0
@ -1533,6 +1542,7 @@ class Boss(Animation):
self.queue = None
self.brandish_complete = True
self.countdown.reset()
self.halt(self.end_dialogue)
def deactivate(self):
self.active = False
@ -1540,11 +1550,11 @@ class Boss(Animation):
def activate(self):
self.active = True
def combo(self):
def combo(self, delay=2500):
self.queue = None
if self.get_game().serial_enabled():
self.get_game().reset_arduino()
self.play(self.brandish, delay=2500, play_once=True)
self.play(self.brandish, delay=delay, play_once=True)
def brandish(self):
self.queue = []
@ -1762,6 +1772,8 @@ class Boss(Animation):
" manage to defeat\nall of us?")
if self.player_defeated:
self.countdown.activate()
else:
self.play(self.end_dialogue, delay=5000, play_once=True)
def transition_to_battle(self):
index = self.level_index + (not self.player_defeated)
@ -1787,11 +1799,18 @@ class Boss(Animation):
elif self.level_index == 2:
self.spoopy.set_frameset(0)
def end_dialogue(self):
self.get_game().dialogue.deactivate()
if not self.battle_finished:
self.combo(delay=1300)
else:
self.get_game().wipe.start(self.transition_to_battle)
def update(self):
if self.active:
self.backgrounds[self.level_index].update()
dialogue = self.get_game().dialogue
if dialogue.active and self.get_game().chemtrails.boys.amount > 0:
if self.countdown.active and dialogue.active and self.get_game().chemtrails.boys.amount > 0:
if self.advance_prompt.check_first_press():
self.advance_prompt.press_first()
elif self.advance_prompt.check_second_press():
@ -1823,6 +1842,7 @@ class Boss(Animation):
dialogue = self.get_game().dialogue
if dialogue.active:
self.get_game().dialogue.update()
if self.countdown.active:
self.advance_prompt.update()
@ -2029,7 +2049,7 @@ class Ending(Animation):
self.slime_bag.location.center = self.get_display_surface().get_rect().centerx, 300
self.tony_avatar = load(self.get_resource("Introduction_tony_avatar.png")).convert()
self.advance_prompt = AdvancePrompt(self)
self.register(self.start)
self.register(self.start, self.start_wipe)
def reset(self):
self.deactivate()
@ -2052,12 +2072,18 @@ class Ending(Animation):
self.text = RainbowSprite(self, foreground, 180, 200)
self.text.location.midtop = dsr.centerx, 80
self.get_game().tony.set_frameset("static")
dialogue = self.get_game().dialogue
dialogue.activate()
dialogue.set_avatar(self.tony_avatar)
dialogue.set_name("???")
dialogue.show_text("")
self.play(self.start_wipe, delay=20000, 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.activate()
# dialogue.set_avatar(self.tony_avatar)
dialogue.set_name("Tony")
dialogue.show_text(self.TEXT[0])
self.text_index = 0
@ -2074,18 +2100,18 @@ class Ending(Animation):
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()
# 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_game().logo.update()
self.get_game().tony.update()
self.slime_bag.update()
@ -2109,5 +2135,5 @@ class Ending(Animation):
self.text.move(dx, dy)
self.text.update()
self.get_game().dialogue.update()
if not wipe.is_playing() and not self.is_playing(self.start):
self.advance_prompt.update()
# if not wipe.is_playing() and not self.is_playing(self.start):
# self.advance_prompt.update()

2
config
View File

@ -35,4 +35,4 @@ timer-start-time = 7000
timer-addition = 1000
sword-delay = 300
attract-gif-length = 10000
attract-board-length = 4000
attract-board-length = 3600

View File

@ -18,4 +18,5 @@
173960
237842
171298
164711
198296
142464

BIN
resource/sfx/comeOn.ogg Normal file

Binary file not shown.