Exemple #1
0
    def render(self, world):
        context = world.find_component("context")
        screen = context["screen"]

        surf = pygame.Surface((screen.get_width() // 2 - 30, 210))
        screen.blit(
            surf,
            (screen.get_width() // 4 + 15, screen.get_height() // 2 - 30))

        text = self.font.render("Press right and left to rotate while flying.",
                                True, (245, 245, 245))
        screen.blit(
            text,
            (screen.get_width() // 4 + 25, screen.get_height() // 2 - 20))

        text = self.font.render("Don't crash into the ground.", True,
                                (245, 245, 245))
        screen.blit(
            text,
            (screen.get_width() // 4 + 25, screen.get_height() // 2 + 20))

        text = self.font.render("Shoot for the moon.", True, (245, 245, 245))
        screen.blit(
            text,
            (screen.get_width() // 4 + 25, screen.get_height() // 2 + 60))

        # Display the buttons
        render_all_buttons(screen, world)
Exemple #2
0
    def render(self, world):
        context = world.find_component("context")
        screen = context["screen"]

        # Draw a nice background
        screen.blit(
            pygame.image.load(find_data_file("resources/bg_space.png")),
            (0, 0))
        screen.blit(
            pygame.image.load(find_data_file("resources/bg_space.png")),
            (0, 500))

        # Moon's hot
        moon_sprite = pygame.sprite.Sprite()
        moon_sprite.image = pygame.image.load(
            find_data_file("resources/object_moon.png"))
        moon_sprite.rect = moon_sprite.image.get_rect()
        moon_sprite.rect.centerx = screen.get_width() / 2
        moon_sprite.rect.centery = screen.get_height() / 2 + 30
        screen.blit(moon_sprite.image, moon_sprite.rect)

        # Sub text backing box
        pygame.draw.rect(
            screen,
            (10, 10, 10),
            [
                screen.get_width() // 2 - 300,
                190 - 15 - 10,  # text y position - half font height - buffer
                600,
                50,
            ],
        )

        # Text
        self.victory_screen.draw(screen)

        # Icarus himself
        radius = 145
        radians = math.radians(self.angle)
        icarus_sprite = pygame.sprite.Sprite()
        icarus_sprite.image = pygame.image.load(
            find_data_file("resources/icarus_body.png"))
        rotated_image = pygame.transform.rotate(icarus_sprite.image,
                                                self.angle * -1 - 90)
        icarus_sprite.rect = rotated_image.get_rect()
        icarus_sprite.rect.centerx = (moon_sprite.rect.centerx +
                                      math.cos(radians) * radius)
        icarus_sprite.rect.centery = (moon_sprite.rect.centery +
                                      math.sin(radians) * radius)
        screen.blit(rotated_image, icarus_sprite.rect)

        # Rotate Icarus
        self.angle += 1
        self.angle %= 360

        # Display the buttons
        render_all_buttons(screen, world)
Exemple #3
0
    def render(self, world):
        context = world.find_component("context")
        screen = context["screen"]

        surf = pygame.Surface((screen.get_width() // 2 + 40, 630))
        screen.blit(surf, (screen.get_width() // 4 - 20, 280))

        text = self.font.render("Programmed By:", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 300))
        text = self.font.render("Austin Decker", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 340))
        text = self.font.render("Dan Muckerman", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 375))
        text = self.font.render("Chris Yealy", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 410))

        text = self.font.render("Sprites By:", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 2 + 60, 300))
        text = self.font.render("Austin Forry", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 2 + 60, 340))

        prod = pygame.sprite.Sprite()
        prod.image = self.font.render("A Technical Incompetence Production", 1,
                                      (240, 240, 240))
        prod.rect = prod.image.get_rect(centerx=screen.get_width() // 2,
                                        centery=470)
        screen.blit(prod.image, prod.rect)

        text = self.font.render("Audio and Button sprites from:", True,
                                (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 570))
        text = self.font.render("kenney.nl", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 610))

        text = self.font.render("Fonts Used:", True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 660))
        text = self.atari_font.render("Atari Font by Genshichi Yasui", True,
                                      (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 700))
        text = self.arcade_font.render("Arcade Classic Font by Koen Hachmang",
                                       True, (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 725))
        text = self.font.render("DpComic Font by codeman38", True,
                                (245, 245, 245))
        screen.blit(text, (screen.get_width() // 4, 748))

        # Display the buttons
        render_all_buttons(screen, world)
Exemple #4
0
    def render(self, world):
        context = world.find_component("context")

        screen = context["screen"]

        # Blit the text to the screen over top of the background surface
        overlay = pygame.Surface((screen.get_width(), screen.get_height()),
                                 pygame.SRCALPHA)
        overlay.fill((0, 0, 0, 175))
        screen.blit(overlay, overlay.get_rect())

        # Render the static pause screen elements
        self.pause_screen.draw(screen)

        # Display the buttons
        render_all_buttons(screen, world)
Exemple #5
0
    def render(self, world):
        context = world.find_component("context")
        screen = context["screen"]

        surf = pygame.Surface((screen.get_width() // 2 - 30, 170))
        screen.blit(
            surf,
            (screen.get_width() // 4 + 15, screen.get_height() // 2 - 30))

        text = self.font.render("Press right and left to rotate while flying.",
                                True, (245, 245, 245))
        screen.blit(
            text,
            (screen.get_width() // 4 + 25, screen.get_height() // 2 - 20))

        text = self.font.render("Press space to boost with the jet booster.",
                                True, (245, 245, 245))
        screen.blit(
            text,
            (screen.get_width() // 4 + 25, screen.get_height() // 2 + 20))

        # Display the buttons
        render_all_buttons(screen, world)
Exemple #6
0
    def render(self, world):
        context = world.find_component("context")
        screen = context["screen"]

        # Display the buttons
        render_all_buttons(screen, world)
Exemple #7
0
    def render(self, world):
        context = world.find_component("context")
        settings = world.find_component("settings")
        screen = context["screen"]

        player_entity = world.find_entity("player")

        # Draw a nice background
        screen.blit(pygame.image.load(find_data_file("resources/bg_sky.png")), (0, 0))
        screen.blit(pygame.image.load(find_data_file("resources/bg_sky.png")), (0, 500))

        # text
        text = self.font.render(
            f"Money for upgrades: ${player_entity.player.currency}",
            True,
            (245, 245, 245),
        )
        screen.blit(text, (50, 50))

        text = self.big_font.render("Legs:", True, (245, 245, 245))
        screen.blit(text, (120, 480))
        pygame.draw.line(screen, (245, 245, 245), (120, 531), (223, 531), width=8)

        text = self.font.render("Jet Booster", True, (245, 245, 245))
        screen.blit(text, (180, 572))
        if player_entity.player.hasJetBoots == 1:
            text = self.font.render("Owned", True, (245, 245, 245))
        else:
            text = self.font.render(
                f"Cost: ${settings['jetBootsCost']}", True, (245, 245, 245)
            )
        screen.blit(text, (180, 605))

        text = self.big_font.render("Arms:", True, (245, 245, 245))
        screen.blit(text, (640, 480))
        pygame.draw.line(screen, (245, 245, 245), (640, 531), (763, 531), width=8)

        text = self.font.render("Cloud Sleeves", True, (245, 245, 245))
        screen.blit(text, (700, 572))
        if player_entity.player.hasCloudSleeves == 1:
            text = self.font.render("Owned", True, (245, 245, 245))
        else:
            text = self.font.render(
                f"Cost: ${settings['cloudSleevesCost']}", True, (245, 245, 245)
            )
        screen.blit(text, (700, 605))

        text = self.font.render("Bird Wings", True, (245, 245, 245))
        screen.blit(text, (700, 672))
        if player_entity.player.hasWings == 1:
            text = self.font.render("Owned", True, (245, 245, 245))
        else:
            text = self.font.render(
                f"Cost: ${settings['wingsCost']}", True, (245, 245, 245)
            )
        screen.blit(text, (700, 705))

        # Icarus himself
        sprite = pygame.sprite.Sprite()
        sprite.image = pygame.image.load(find_data_file("resources/icarus_body.png"))
        sprite.image = pygame.transform.scale(sprite.image, (288, 200))
        sprite.rect = sprite.image.get_rect()
        sprite.rect.centerx = screen.get_width() // 2
        sprite.rect.centery = screen.get_height() // 2 - 240 + self.icarus_offset
        screen.blit(sprite.image, sprite.rect)

        # Display the buttons
        render_all_buttons(screen, world)

        # Flip display to render lines
        pygame.display.flip()

        self.icarus_offset = self.icarus_offset + self.icarus_offset_increment

        if abs(self.icarus_offset) > 10:
            self.icarus_offset_increment = self.icarus_offset_increment * -1
Exemple #8
0
    def render(self, world):
        context = world.find_component("context")
        settings = world.find_component("settings")
        screen = context["screen"]

        player_entity = world.find_entity("player")

        # Draw a nice background
        screen.blit(pygame.image.load(find_data_file("resources/bg_sky.png")),
                    (0, 0))
        screen.blit(pygame.image.load(find_data_file("resources/bg_sky.png")),
                    (0, 500))

        # text
        text = self.font.render(
            f"Money for upgrades: ${player_entity.player.currency}",
            True,
            (245, 245, 245),
        )
        screen.blit(text, (50, 50))

        text = self.big_font.render("Legs:", True, (245, 245, 245))
        screen.blit(text, (120, 480 - 200))
        pygame.draw.line(screen, (245, 245, 245), (120, 531 - 200),
                         (223, 531 - 200),
                         width=8)

        text = self.font.render("Jet Booster", True, (245, 245, 245))
        screen.blit(text, (180, 550 - 200))
        if player_entity.player.hasJetBoots == 1:
            text = self.font.render("Owned", True, (245, 245, 245))
        else:
            text_color = ((120, 250, 40) if player_entity.player.currency >=
                          settings["jetBootsCost"] else (170, 200, 200))
            text = self.font.render(f"Cost: ${settings['jetBootsCost']}", True,
                                    text_color)
        screen.blit(text, (180, 582 - 200))
        text = self.small_font.render("Press space to give yourself a boost!",
                                      True, (230, 200, 85))
        screen.blit(text, (120, 614 - 200))

        text = self.font.render("More Fuel", True, (245, 245, 245))
        screen.blit(text, (180, 650 - 200))
        if player_entity.player.extraFuel == 9:
            text = self.font.render("Maxed Out", True, (245, 245, 245))
        else:
            text_color = ((120, 250, 40) if
                          player_entity.player.currency >= self.extra_fuel_cost
                          else (170, 200, 200))
            text = self.font.render(f"Cost: ${self.extra_fuel_cost}", True,
                                    text_color)
        screen.blit(text, (180, 682 - 200))
        text = self.small_font.render("More fuel means more boosting!", True,
                                      (230, 200, 85))
        screen.blit(text, (120, 714 - 200))
        if player_entity.player.hasJetBoots > 0:
            text = self.small_font.render(
                f"Total boosts: {player_entity.player.extraFuel + 1}{'! Wow!' if player_entity.player.extraFuel == 9 else ''}",
                True,
                (220, 40, 10),
            )
            screen.blit(text, (120, 744 - 200))

        text = self.big_font.render("Arms:", True, (245, 245, 245))
        screen.blit(text, (640, 480 - 200))
        pygame.draw.line(screen, (245, 245, 245), (640, 531 - 200),
                         (763, 531 - 200),
                         width=8)

        text = self.font.render("Cloud Sleeves", True, (245, 245, 245))
        screen.blit(text, (700, 550 - 200))
        if player_entity.player.hasCloudSleeves == 1:
            text = self.font.render("Owned", True, (245, 245, 245))
        else:
            text_color = ((120, 250, 40) if player_entity.player.currency >=
                          settings["cloudSleevesCost"] else (170, 200, 200))
            text = self.font.render(f"Cost: ${settings['cloudSleevesCost']}",
                                    True, text_color)
        screen.blit(text, (700, 582 - 200))
        text = self.small_font.render("Don't let gravity get you down!", True,
                                      (230, 200, 85))
        screen.blit(text, (640, 614 - 200))

        text = self.font.render("Bird Wings", True, (245, 245, 245))
        screen.blit(text, (700, 650 - 200))
        if player_entity.player.hasWings == 1:
            text = self.font.render("Owned", True, (245, 245, 245))
        else:
            text_color = ((120, 250, 40) if player_entity.player.currency >=
                          settings["wingsCost"] else (170, 200, 200))
            text = self.font.render(f"Cost: ${settings['wingsCost']}", True,
                                    text_color)
        screen.blit(text, (700, 682 - 200))
        text = self.small_font.render(
            "Make tighter turns! Y'know, like a bird. Just go with it.",
            True,
            (230, 200, 85),
        )
        screen.blit(text, (640, 714 - 200))
        text = self.small_font.render(
            "If you want to pretend you don't have wings, hold shift.",
            True,
            (230, 200, 85),
        )
        screen.blit(text, (640, 744 - 200))

        # Icarus himself
        sprite = pygame.sprite.Sprite()
        sprite.image = pygame.image.load(
            find_data_file("resources/icarus_body.png"))
        sprite.image = pygame.transform.scale(sprite.image, (288, 200))
        sprite.rect = sprite.image.get_rect()
        sprite.rect.centerx = screen.get_width() // 2
        sprite.rect.centery = screen.get_height(
        ) // 2 - 200 + self.icarus_offset
        screen.blit(sprite.image, sprite.rect)

        # Display the buttons
        render_all_buttons(screen, world)

        # Flip display to render lines
        pygame.display.flip()

        self.icarus_offset = self.icarus_offset + self.icarus_offset_increment

        if abs(self.icarus_offset) > 10:
            self.icarus_offset_increment = self.icarus_offset_increment * -1
Exemple #9
0
    def render(self, world):
        context = world.find_component("context")
        screen = context["screen"]

        surf = pygame.Surface(
            (screen.get_width() // 2 + 40, screen.get_height() - 280 - 100))

        text = self.font.render("Programmed By:", True, (245, 245, 245))
        surf.blit(text, (20, 20 + self.scroll_offset))
        text = self.font.render("Austin Decker", True, (245, 245, 245))
        surf.blit(text, (20, 60 + self.scroll_offset))
        text = self.font.render("Dan Muckerman", True, (245, 245, 245))
        surf.blit(text, (20, 95 + self.scroll_offset))
        text = self.font.render("Chris Yealy", True, (245, 245, 245))
        surf.blit(text, (20, 130 + self.scroll_offset))

        text = self.font.render("Sprites By:", True, (245, 245, 245))
        surf.blit(text, (surf.get_width() // 2 + 60, 20 + self.scroll_offset))
        text = self.font.render("Austin Forry", True, (245, 245, 245))
        surf.blit(text, (surf.get_width() // 2 + 60, 60 + self.scroll_offset))

        prod = pygame.sprite.Sprite()
        prod.image = self.font.render("A Technical Incompetence Production",
                                      True, (240, 240, 240))
        prod.rect = prod.image.get_rect(centerx=surf.get_width() // 2,
                                        centery=190 + self.scroll_offset)
        surf.blit(prod.image, prod.rect)

        text = self.font.render("Sound fx and buttons:", True, (245, 245, 245))
        surf.blit(text, (20, 290 + self.scroll_offset))
        text = self.font.render("kenney.nl", True, (245, 245, 245))
        surf.blit(text, (20, 330 + self.scroll_offset))

        text = self.font.render("Music:", True, (245, 245, 245))
        surf.blit(text, (surf.get_width() // 2 + 60, 290 + self.scroll_offset))
        text = self.font.render("freepd.com", True, (245, 245, 245))
        surf.blit(text, (surf.get_width() // 2 + 60, 330 + self.scroll_offset))

        text = self.font.render("Fonts Used:", True, (245, 245, 245))
        surf.blit(text, (20, 380 + self.scroll_offset))
        text = self.atari_font.render("Atari Font by Genshichi Yasui", True,
                                      (245, 245, 245))
        surf.blit(text, (20, 420 + self.scroll_offset))
        text = self.arcade_font.render("Arcade Classic Font by Koen Hachmang",
                                       True, (245, 245, 245))
        surf.blit(text, (20, 445 + self.scroll_offset))
        text = self.font.render("DpComic Font by codeman38", True,
                                (245, 245, 245))
        surf.blit(text, (20, 468 + self.scroll_offset))

        # Arrows to indicate scrolling is available
        if self.scroll_offset < 0:
            up_triangle = (
                (surf.get_width() - 35, 30),  # bottom left
                (surf.get_width() - 15, 30),  # bottom right
                (surf.get_width() - 25, 15),  # top
            )
            pygame.draw.polygon(surf, (245, 245, 245), up_triangle)
        if self.scroll_offset > -180:
            down_triangle = (
                (surf.get_width() - 35, surf.get_height() - 30),  # top left
                (surf.get_width() - 15, surf.get_height() - 30),  # top right
                (surf.get_width() - 25, surf.get_height() - 15),  # bottom
            )
            pygame.draw.polygon(surf, (245, 245, 245), down_triangle)

        screen.blit(surf, (screen.get_width() // 4 - 20, 280))

        # Display the buttons
        render_all_buttons(screen, world)