diff --git a/.gitignore b/.gitignore index 1797c79..03583d2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ local/ MANIFEST dist/ build/ +*.mp4 diff --git a/NS.py b/NS.py index 26efe79..f1e0d98 100644 --- a/NS.py +++ b/NS.py @@ -52,11 +52,11 @@ class NS(Game, Animation): ds = self.get_display_surface() self.background = Surface(ds.get_size()) self.background.fill((0, 0, 0)) + self.platform = Platform(self) self.title = Title(self) self.introduction = Introduction(self) self.ending = Ending(self) self.wipe = Wipe(self) - self.platform = Platform(self) self.dialogue = Dialogue(self) self.chemtrails = Chemtrails(self) self.boss = Boss(self) @@ -176,6 +176,52 @@ class NS(Game, Animation): self.reset() +class Button(Sprite): + + MARGIN = 2 + BLANK = (200, 200, 200) + + def __init__(self, parent, edge, size, border): + Sprite.__init__(self, parent) + colors = self.get_game().platform.get_color_pair_from_edge(edge) + width = size * 2 + self.MARGIN + border * 4 + step = width / 2 + self.MARGIN / 2 + rect_width = width / 2 - self.MARGIN / 2 + rects = Rect(0, 0, rect_width, rect_width), \ + Rect(step, 0, rect_width, rect_width), \ + Rect(step, step, rect_width, rect_width), \ + Rect(0, step, rect_width, rect_width) + if edge == NS.N: + colored = rects[0], rects[1] + elif edge == NS.NE: + colored = rects[1], rects[3] + elif edge == NS.E: + colored = rects[1], rects[2] + elif edge == NS.NW: + colored = rects[0], rects[2] + elif edge == NS.S: + colored = rects[3], rects[2] + elif edge == NS.W: + colored = rects[0], rects[3] + for lightness in xrange(30, 90, 5): + frame = Surface((width, width), SRCALPHA) + for topleft in (0, 0), (step, 0), (step, step), (0, step): + rect = Rect(topleft, (rect_width, rect_width)) + border_color = Color(*self.BLANK) + border_color.a = 179 + frame.fill(border_color, rect) + frame.fill((0, 0, 0, 0), rect.inflate(-border * 2, -border * 2)) + for ii in xrange(2): + original_color = Color(*colors[ii]) + original_color.a = 255 + edited_color = Color(0, 0, 0) + edited_color.hsla = int(original_color.hsla[0]), int(original_color.hsla[1]), \ + lightness, 70 + frame.fill(edited_color, colored[ii]) + frame.fill(original_color, colored[ii].inflate(-border * 2, -border * 2)) + self.add_frame(frame) + + class Title(GameChild): def __init__(self, parent): @@ -194,18 +240,19 @@ class Title(GameChild): self.border.location.center = dsr.centerx, dsr.bottom - 100 self.text = Sprite(self) self.text.load_from_path(self.get_resource("Title_text.png"), True, False, (255, 0, 0)) - self.text.load_from_path(self.get_resource("Title_text_half.png"), True, False, (255, 0, 0)) - self.text.add_frameset([0], name="full", switch=True) - self.text.add_frameset([1], name="half") self.text.location.center = dsr.centerx, dsr.bottom - 100 self.angle = choice((pi / 4, 3 * pi / 4, 5 * pi / 4, 7 * pi / 4)) self.button_sound = self.get_game().sfx["button"] + self.buttons = Button(self, NS.N, 10, 4), Button(self, NS.NW, 10, 4) + self.buttons[0].location.center = 277, 381 + self.buttons[1].location.center = 453, 381 def reset(self): self.activate() self.first_pressed = False self.first_pressed_elapsed = 0 - self.text.set_frameset("full") + for button in self.buttons: + button.unhide() def activate(self): self.active = True @@ -277,7 +324,7 @@ class Title(GameChild): if not self.first_pressed and self.get_game().platform.get_edge_pressed() == NS.N: self.first_pressed = True self.first_pressed_elapsed = 0 - self.text.set_frameset("half") + self.buttons[0].hide() self.button_sound.play() elif not wipe.is_playing() and self.first_pressed and \ self.get_game().platform.get_edge_pressed() == NS.NW: @@ -288,10 +335,12 @@ class Title(GameChild): if self.first_pressed_elapsed > 4000: self.first_pressed = False self.first_pressed_elapsed = 0 - self.text.set_frameset("full") + self.buttons[0].unhide() self.border.update() self.text.update() self.draw_scores() + for button in self.buttons: + button.update() class Dialogue(Animation): @@ -529,31 +578,54 @@ class Introduction(Animation): self.skip_prompt.update() -class SkipPrompt(Sprite): +class SkipPrompt(GameChild): def __init__(self, parent, callback): - Sprite.__init__(self, parent) + GameChild.__init__(self, parent) self.callback = callback - for ii in xrange(3): - self.load_from_path(self.get_resource("Skip_%i.png" % ii), True) - self.add_frameset([ii]) + self.buttons = [] + self.pluses = [] + 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[-1].location.topleft = left, top + if ii < 2: + self.pluses.append(Sprite(self)) + self.pluses[-1].load_from_path(self.get_resource("Plus.png"), True) + self.pluses[-1].location.center = ( + self.buttons[-1].location.right + AdvancePrompt.BUTTON_SPACING / 2, + self.buttons[-1].location.centery) + left += self.buttons[-1].location.width + AdvancePrompt.BUTTON_SPACING + self.text = Sprite(self) + font = Font(self.get_resource(Dialogue.FONT_PATH), 18) + self.text.add_frame(font.render("TO SKIP", True, (0, 0, 0))) + self.text.location.midleft = ( + self.buttons[2].location.right + 5, + self.buttons[2].location.centery) self.button_sound = self.get_game().sfx["button"] def reset(self): self.press_index = 0 self.press_elapsed = 0 - self.set_frameset(1) + for button in self.buttons: + button.unhide() + for plus in self.pluses: + plus.unhide() def update(self): platform = self.get_game().platform if self.press_index == 0 and platform.get_edge_pressed() == NS.S: self.press_index += 1 - self.set_frameset(2) self.button_sound.play() + self.buttons[0].hide() + self.pluses[0].hide() elif self.press_index == 1 and platform.get_edge_pressed() == NS.NE: self.press_index += 1 - self.set_frameset(3) self.button_sound.play() + self.buttons[1].hide() + self.pluses[1].hide() elif self.press_index == 2 and platform.get_edge_pressed() == NS.W: self.callback() self.get_game().sfx["confirm"].play() @@ -561,36 +633,52 @@ class SkipPrompt(Sprite): self.press_elapsed += self.get_game().time_filter.get_last_frame_duration() if self.press_elapsed > 4000: self.reset() - Sprite.update(self) + for button in self.buttons: + button.update() + for plus in self.pluses: + plus.update() + self.text.update() -class AdvancePrompt(Sprite): +class AdvancePrompt(GameChild): + + BUTTON_SIZE = 8 + BUTTON_BORDER = 1 + BUTTON_SPACING = 27 def __init__(self, parent): - Sprite.__init__(self, parent) - self.load_from_path(self.get_resource("Dialogue_buttons_full.png"), True, - False, (255, 255, 255)) - self.load_from_path(self.get_resource("Dialogue_buttons_half.png"), True, - False, (255, 255, 255)) - self.add_frameset([0], name="full", switch=True) - self.add_frameset([1], name="half") + GameChild.__init__(self, parent) dsr = self.get_display_surface().get_rect() - self.location.bottomright = dsr.right - 3, dsr.bottom - 3 + 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 def reset(self): self.cancel_first_press() + for button in self.buttons: + button.unhide() + self.plus.unhide() def cancel_first_press(self): self.first_pressed = False self.first_pressed_elapsed = 0 - self.set_frameset("full") + self.buttons[0].unhide() + self.plus.unhide() def check_first_press(self): return not self.first_pressed and self.get_game().platform.get_edge_pressed() == NS.N def press_first(self): self.first_pressed = True - self.set_frameset("half") + self.buttons[0].hide() + self.plus.hide() self.get_game().sfx["button"].play() def check_second_press(self): @@ -604,7 +692,9 @@ class AdvancePrompt(Sprite): self.first_pressed_elapsed += self.get_game().time_filter.get_last_frame_duration() if self.first_pressed_elapsed > 4000: self.cancel_first_press() - Sprite.update(self) + for button in self.buttons: + button.update() + self.plus.update() class Wipe(Animation): diff --git a/resource/Dialogue_buttons_full.png b/resource/Dialogue_buttons_full.png deleted file mode 100644 index 1e131ba..0000000 Binary files a/resource/Dialogue_buttons_full.png and /dev/null differ diff --git a/resource/Dialogue_buttons_half.png b/resource/Dialogue_buttons_half.png deleted file mode 100644 index 0a81a86..0000000 Binary files a/resource/Dialogue_buttons_half.png and /dev/null differ diff --git a/resource/Plus.png b/resource/Plus.png new file mode 100644 index 0000000..a295303 Binary files /dev/null and b/resource/Plus.png differ diff --git a/resource/Skip_0.png b/resource/Skip_0.png deleted file mode 100644 index 8f87771..0000000 Binary files a/resource/Skip_0.png and /dev/null differ diff --git a/resource/Skip_1.png b/resource/Skip_1.png deleted file mode 100644 index 82fd769..0000000 Binary files a/resource/Skip_1.png and /dev/null differ diff --git a/resource/Skip_2.png b/resource/Skip_2.png deleted file mode 100644 index de0c96f..0000000 Binary files a/resource/Skip_2.png and /dev/null differ diff --git a/resource/Title_border.png b/resource/Title_border.png index ad33be5..7ba251c 100644 Binary files a/resource/Title_border.png and b/resource/Title_border.png differ diff --git a/resource/Title_text.png b/resource/Title_text.png index 2987a2b..676bd3f 100644 Binary files a/resource/Title_text.png and b/resource/Title_text.png differ diff --git a/resource/Title_text_half.png b/resource/Title_text_half.png deleted file mode 100644 index f53d5b3..0000000 Binary files a/resource/Title_text_half.png and /dev/null differ diff --git a/www/index.php b/www/index.php index 8ff8c6e..894060a 100644 --- a/www/index.php +++ b/www/index.php @@ -13,11 +13,11 @@ So you think you can skateboard, but can you scrapeboard, you slime bag?
- - - - - + + + + +
diff --git a/www/ss-00.png b/www/ss-00.png new file mode 100644 index 0000000..dc378aa Binary files /dev/null and b/www/ss-00.png differ