diff --git a/NS.py b/NS.py index b7427df..1f37b3a 100644 --- a/NS.py +++ b/NS.py @@ -37,7 +37,7 @@ from lib.pgfw.pgfw.Animation import Animation from lib.pgfw.pgfw.extension import ( get_step, get_step_relative, get_delta, reflect_angle, render_box, get_hsla_color, get_hue_shifted_surface, - get_color_swapped_surface, load_frames + get_color_swapped_surface, load_frames, fill_colorkey ) from lib.pgfw.pgfw.gfx_extension import aa_filled_polygon @@ -733,6 +733,11 @@ class Title(Animation): class Dialogue(Animation): + """ + This class creates the graphics for displaying character dialog. It displays an avatar, a character name, and a box with the + dialog text in classic RPG format. It uses the Animation class to scroll the text onto the screen with a sound effect to mimic + talking. + """ BACKGROUND = 255, 255, 255 BORDER = 0, 0, 0 @@ -840,8 +845,7 @@ class SkipPrompt(GameChild): top = 3 left = 3 for ii, edge in enumerate((NS.S, NS.NE, NS.W)): - self.buttons.append(Button(self, edge, AdvancePrompt.BUTTON_SIZE, - AdvancePrompt.BUTTON_BORDER)) + self.buttons.append(Button(self, edge, AdvancePrompt.BUTTON_SIZE, AdvancePrompt.BUTTON_BORDER)) self.buttons[-1].location.topleft = left, top if ii < 2: self.pluses.append(Sprite(self)) @@ -1366,15 +1370,12 @@ class Light(Animation): boss = self.get_game().boss chemtrails = self.get_game().chemtrails # checks the boss attack queue and chameleon queue index to see if the glow should be started now - if boss.queue and boss.brandish_complete and not self.is_playing(self.glow) \ + if boss.queue and not self.is_playing(self.glow) \ and self.in_orientation(boss.queue[chemtrails.queue_index]): self.play(self.glow) # turns off the glow elif self.is_playing(self.glow) and (not boss.queue or not self.in_orientation(boss.queue[chemtrails.queue_index])): self.reset() - # if not self.hidden: - # ds = self.get_display_surface() - # aa_filled_polygon(ds, self.get_points(), self.color) def get_points(self): if self.get_game().title.active: @@ -1561,7 +1562,7 @@ class Life(Meter): dsr = self.get_display_surface().get_rect() background = load(self.get_resource("HUD_health.png")).convert() rect = background.get_rect() - rect.bottomleft = 172, dsr.bottom - 4 + rect.bottomleft = 4, dsr.bottom - 4 self.setup(background, rect, 70, (255, 0, 0), 3, "scrapeIcons/scrapeIcons_03.png") def decrease(self): @@ -1609,7 +1610,7 @@ class Boss(Animation): self.visitor = Sprite(self, 42) self.visitor.load_from_path("alienAnimations/alienBoil", True) for sprite in self.kool_man, self.visitor, self.spoopy: - sprite.location.topleft = 100, 0 + sprite.location.topleft = 207, 10 self.health = Health(self) self.sword = Sword(self) self.register(self.brandish, self.cancel_flash, self.show_introduction_dialogue, @@ -1650,7 +1651,9 @@ class Boss(Animation): } orientation_frame_indices = {} for path, orientation in static_arm_frame_map.items(): - self.alien_arm.load_from_path(list(root.glob(path))[0], True) + base = pygame.image.load(str(list(root.glob(path))[0])) + colorkeyed = fill_colorkey(base) + self.alien_arm.add_frame(colorkeyed) frame_index = len(self.alien_arm.frames) - 1 self.alien_arm.add_frameset([frame_index], name=str(orientation)) orientation_frame_indices[orientation] = frame_index @@ -1724,13 +1727,13 @@ class Boss(Animation): dialogue.activate() if self.level_index == 0: dialogue.show_text("You'll never be able to block my sword, you lizard slime!" + - " See\nif you can keep up with these moves!") + " See if you can keep up\nwith these moves!") elif self.level_index == 1: dialogue.show_text("We're just warming up, slime breath! Prepare to get spun" + - " by\nthese combos!") + " by these combos!") elif self.level_index == 2: dialogue.show_text("Lizard! My moves are so unpredictable you might as well" + - " give\nup now!") + " give up now!") self.play(self.end_dialogue, delay=5000, play_once=True) def reset(self): @@ -1974,7 +1977,7 @@ class Boss(Animation): dialogue.show_text("Just like I thought!") else: dialogue.show_text("H-how? But you're only a lizard! How could you" + - " manage to defeat\nall of us?") + " manage to defeat all of us?") if self.player_defeated: self.countdown.activate() else: @@ -2036,7 +2039,18 @@ class Boss(Animation): self.kool_man.update() elif self.level_index == 1: self.visitor.update() - self.alien_arm.update() + if self.brandish_complete: + if self.queue is not None: + self.alien_arm.unhide() + remaining_positions = list(reversed(self.queue[self.get_game().chemtrails.queue_index:])) + for ii, position in enumerate(remaining_positions): + alpha = int((ii + 1) / len(remaining_positions) * 255) + self.alien_arm.set_frameset(str(position)) + self.alien_arm.get_current_frame().set_alpha(alpha) + self.alien_arm.update() + self.alien_arm.get_current_frame().set_alpha(255) + else: + self.alien_arm.update() elif self.level_index == 2: self.spoopy.update() self.sword.update() @@ -2113,12 +2127,13 @@ class Sword(Animation): def __init__(self, parent): Animation.__init__(self, parent) swords = self.swords = [] - for root in "Sword_kool_man/", "Sword_visitor/", "Sword_spoopy/": + #for root in "Sword_kool_man/", "Sword_visitor/", "Sword_spoopy/": + for root in "Sword_kool_man/", "local/test/", "Sword_spoopy/": swords.append([[], [], [], [], [], []]) base_image_paths = sorted(iglob(join(self.get_resource(root), "*.png"))) if not self.get_configuration("display", "effects"): base_image_paths = [base_image_paths[0]] - for path in base_image_paths: + for frame_index, path in enumerate(base_image_paths): base = load(self.get_resource(path)).convert_alpha() for position in range(6): if position == NS.N or position == NS.S: @@ -2133,6 +2148,11 @@ class Sword(Animation): colors = self.get_game().platform.get_color_pair_from_edge(position) color_a = Color(colors[0].r, colors[0].g, colors[0].b, 255) color_b = Color(colors[1].r, colors[1].g, colors[1].b, 255) + # edit lightness to create glowing effect + for color in (color_a, color_b): + h, s, l, a = color.hsla + l = 30 + int(abs((frame_index % 10) - 5) / 5 * 60) + color.hsla = h, s, l, a rect = surface.get_rect() if position == NS.N or position == NS.S: surface.fill(color_a, (0, 0, rect.w / 2, rect.h), BLEND_RGBA_MIN) @@ -2168,7 +2188,7 @@ class Sword(Animation): for frame in self.swords[level_index][position]: sprite.add_frame(frame) if position in (NS.W, NS.E): - sprite.location.centery = dsr.centery - 100 + offset + sprite.location.centery = dsr.centery - 80 + offset if position == NS.W: sprite.location.centerx = dsr.centerx - 100 - offset else: @@ -2176,11 +2196,11 @@ class Sword(Animation): elif position in (NS.N, NS.S): sprite.location.centerx = dsr.centerx - offset if position == NS.N: - sprite.location.centery = dsr.centery - 170 + offset + sprite.location.centery = dsr.centery - 150 + offset else: - sprite.location.centery = dsr.centery + offset + sprite.location.centery = dsr.centery + 20 + offset else: - sprite.location.center = dsr.centerx - offset, dsr.centery - 100 + sprite.location.center = dsr.centerx - offset, dsr.centery - 80 self.sprites.append(sprite) self.get_audio().play_sfx("brandish") self.play(self.lower, delay=400, play_once=True) @@ -2208,16 +2228,9 @@ class Sword(Animation): def update(self): Animation.update(self) - for ii, sprite in enumerate(reversed(self.sprites)): - if ii == len(self.sprites) - 1: - substitute = None - else: - mask = self.masks[int(float(ii + 1) / len(self.sprites) * len(self.masks))] - frame = sprite.get_current_frame() - copy = frame.copy() - copy.blit(mask, (0, 0), None, BLEND_RGBA_MIN) - substitute = copy - sprite.update(substitute=substitute) + # only draw the current sword in the queue + if self.sprites: + self.sprites[0].update() class Health(Meter): @@ -2260,8 +2273,8 @@ class Health(Meter): 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.", + TEXT = "Wow! You vanquished all the goons and skated like a pro, slime bag." + \ + " You made your\nfather proud today. I love you, child.", def __init__(self, parent): Animation.__init__(self, parent) @@ -2304,8 +2317,6 @@ class Ending(Animation): 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 @@ -2322,18 +2333,6 @@ 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() self.get_game().logo.update() self.get_game().tony.update() self.slime_bag.update() @@ -2357,5 +2356,3 @@ 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() diff --git a/config b/config index d3f4234..ad47897 100644 --- a/config +++ b/config @@ -30,7 +30,7 @@ effects = yes [system] # will force set display->effects to off -minimize-load-time = yes +minimize-load-time = no [mouse] visible = no diff --git a/resource/HUD_boss.png b/resource/HUD_boss.png index 02a1063..dba91a4 100644 Binary files a/resource/HUD_boss.png and b/resource/HUD_boss.png differ diff --git a/resource/bg/bg001.png b/resource/bg/bg001.png index fdcaaa2..742d1b2 100644 Binary files a/resource/bg/bg001.png and b/resource/bg/bg001.png differ diff --git a/resource/bg/bg002.png b/resource/bg/bg002.png index 261b18b..88b5da6 100644 Binary files a/resource/bg/bg002.png and b/resource/bg/bg002.png differ diff --git a/resource/bg/bg003.png b/resource/bg/bg003.png index 5082170..83354ca 100644 Binary files a/resource/bg/bg003.png and b/resource/bg/bg003.png differ diff --git a/resource/scores b/resource/scores index e2f8e3a..7ae2e85 100644 --- a/resource/scores +++ b/resource/scores @@ -11,3 +11,4 @@ 52586 54614 52434 +168209