Пример #1
0
    def on_draw(self):
        """Draw anything on the screen"""
        start_render()

        arcade.draw_texture_rectangle(
            (SCREEN_WIDTH // 2),
            (SCREEN_HEIGHT // 2),
            SCREEN_WIDTH,
            SCREEN_HEIGHT,
            self.background,
        )

        # Drawing game name
        arcade.draw_text(
            f"Welcome to {GAME_TITLE}",
            start_x=SCREEN_WIDTH // 2,
            start_y=SCREEN_HEIGHT - 100,
            color=arcade.color.CHINESE_VIOLET,
            font_name=f"{FONTS_DIR}/WarPriestRegular.ttf",
            font_size=50,
            anchor_x="center",
        )

        # Drawing game version
        arcade.draw_text(
            f"Version: {GAME_VERSION}",
            start_x=20,
            start_y=20,
            font_name=f"{FONTS_DIR}/Wooden Log.ttf",
            font_size=20,
            color=arcade.color.ELECTRIC_GREEN,
        )

        return super().on_draw()
Пример #2
0
    def on_draw(self):
        """Draw instructions on the screen"""
        start_render()

        # Drawing the background image
        arcade.draw_texture_rectangle(
            (SCREEN_WIDTH // 2),
            (SCREEN_HEIGHT // 2),
            SCREEN_WIDTH,
            SCREEN_HEIGHT,
            self.background,
        )

        # Blur the background
        draw_lrtb_rectangle_filled(
            left=self.game_view.view_left,
            right=self.game_view.view_left + SCREEN_WIDTH,
            top=self.game_view.view_bottom + SCREEN_HEIGHT,
            bottom=self.game_view.view_bottom,
            color=self.fill_color,
        )

        # Drawing Instructions for Knight Movement and Jump
        arcade.draw_text(
            "Knight Movement",
            start_x=25,
            start_y=550,
            color=arcade.color.CHINESE_VIOLET,
            font_size=50,
            font_name=f"{FONTS_DIR}/FirstJob.ttf",
        )

        # Drawing instructions for Knight's attack
        arcade.draw_text(
            "Knight Attack",
            start_x=580,
            start_y=550,
            color=arcade.color.CHINESE_VIOLET,
            font_size=50,
            font_name=f"{FONTS_DIR}/FirstJob.ttf",
        )

        # Drawing a small hint
        arcade.draw_text(
            "*Press corresponding keys to see some light",
            start_x=540,
            start_y=50,
            color=arcade.color.BLUE_SAPPHIRE,
            font_size=17,
            font_name=f"{FONTS_DIR}/Wooden Log.ttf",
        )

        return super().on_draw()
Пример #3
0
    def on_draw(self):
        """Draws anything to the screen"""
        start_render()

        # Drawing the background image
        arcade.draw_texture_rectangle(
            (SCREEN_WIDTH // 2),
            (SCREEN_HEIGHT // 2),
            SCREEN_WIDTH,
            SCREEN_HEIGHT,
            self.background,
        )

        # Blur the background
        draw_lrtb_rectangle_filled(
            left=self.game_view.view_left,
            right=self.game_view.view_left + SCREEN_WIDTH,
            top=self.game_view.view_bottom + SCREEN_HEIGHT,
            bottom=self.game_view.view_bottom,
            color=self.fill_color,
        )

        # --- Drawing our credits ---
        arcade.draw_text(
            f"Game Version: {GAME_VERSION}",
            start_x=(SCREEN_WIDTH // 2) - 150,
            start_y=(SCREEN_HEIGHT // 2) + 200,
            color=arcade.color.BRICK_RED,
            font_name=f"{FONTS_DIR}/FrostbiteBossFight.ttf",
            font_size=35,
        )

        arcade.draw_text(
            f"Game made by: {DEVELOPER}",
            start_x=(SCREEN_WIDTH // 2) - 250,
            start_y=(SCREEN_HEIGHT // 2) + 150,
            color=arcade.color.BRICK_RED,
            font_name=f"{FONTS_DIR}/FrostbiteBossFight.ttf",
            font_size=35,
        )

        arcade.draw_text(
            f"Game is made using the Python Arcade Library",
            start_x=(SCREEN_WIDTH // 2) - 350,
            start_y=(SCREEN_HEIGHT // 2) + 100,
            color=arcade.color.BRICK_RED,
            font_name=f"{FONTS_DIR}/FrostbiteBossFight.ttf",
            font_size=35,
        )

        return super().on_draw()
Пример #4
0
    def on_draw(self):
        """Draw the loading text on the screen"""

        start_render()

        arcade.draw_text(
            "Loading...",
            start_x=385,
            start_y=300,
            color=arcade.color.BLUE_SAPPHIRE,
            font_size=50,
        )

        return super().on_draw()
Пример #5
0
    def on_draw(self, draw_stats=True):
        """
        We actually have to draw to the display to show anything on the screen.
        This method handles all the drawing in the game
        """
        start_render()

        # Drawing our loaded background images and setting it
        arcade.draw_texture_rectangle(
            (SCREEN_WIDTH // 2) + self.view_left,
            (SCREEN_HEIGHT // 2) + self.view_bottom,
            SCREEN_WIDTH,
            SCREEN_HEIGHT,
            self.background_image,
        )

        self.platforms.draw()
        self.backgrounds.draw()
        self.ladders.draw()
        self.collectibles.draw()
        self.character_sprites.draw()
        self.enemy_sprites.draw()
        self.dont_touch.draw()
        self.foregrounds.draw()

        # Drawing the Knight's stats
        if draw_stats:
            arcade.draw_text(
                f"Score: {self.knight.score}",
                self.view_left,
                self.view_bottom + 15,
                arcade.color.CHROME_YELLOW,
                15,
            )

            arcade.draw_text(
                f"Health: {self.knight.health}",
                self.view_left,
                self.view_bottom,
                arcade.color.ROSE_RED,
                15,
            )

        return super().on_draw()