def draw(self):
     """Draw the rectangle based on the current state
     """
     arcade.draw_xywh_rectangle_filled(self.x, self.y, self.width,
                                       self.height, self.fill_color)
     arcade.draw_xywh_rectangle_outline(self.x, self.y, self.width,
                                        self.height, self.pen_color, 3)
예제 #2
0
def main_menu():
    # Draw Main menu
    arcade.set_background_color(arcade.color.WHITE)
    arcade.draw_text("Legend Of Remake",
                     screen_width / 2,
                     480,
                     arcade.color.BLACK,
                     70,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_xywh_rectangle_outline(screen_width / 2 - 150,
                                       screen_height / 2 - 25, 300, 75,
                                       arcade.color.BLACK, 5)
    arcade.draw_text("Play",
                     screen_width / 2,
                     screen_height / 2 + 13,
                     arcade.color.BLACK,
                     30,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_xywh_rectangle_outline(screen_width / 2 - 150,
                                       screen_height / 2 - 125, 300, 75,
                                       arcade.color.BLACK, 5)
    arcade.draw_text("How to Play",
                     screen_width / 2,
                     screen_height / 2 - 87,
                     arcade.color.BLACK,
                     30,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
def on_draw():
    arcade.start_render()
    # Draw in here...
    arcade.draw_circle_outline(100, 200, 40, arcade.color.BLACK)
    arcade.draw_line(100, 160, 100, 70, arcade.color.BLACK)
    arcade.draw_line(50, 155, 100, 120, arcade.color.BLACK)
    arcade.draw_line(150, 155, 100, 120, arcade.color.BLACK)
    arcade.draw_line(50, 25, 100, 70, arcade.color.BLACK)
    arcade.draw_line(150, 25, 100, 70, arcade.color.BLACK)
    arcade.draw_text("STOP: Log off the site.", 200, 500, arcade.color.RED, 15)
    arcade.draw_text("BLOCK: Don't respond to the messages.", 200, 400, arcade.color.YELLOW, 15)
    arcade.draw_text("RECORD: Save the message.", 200, 300, arcade.color.GREEN, 15)
    arcade.draw_text("TALK: Tell a trusted adult the situation", 200, 200, arcade.color.BLUE, 15)

    texture = arcade.load_texture("Leomarc_stop_sign.png")
    scale = .1
    arcade.draw_texture_rectangle(340, 100, scale * texture.width,
                                  scale * texture.height, texture, 0)

    texture = arcade.load_texture("cantoon-clipart-sunglasses.png")
    scale = .1
    arcade.draw_texture_rectangle(100, y, scale * texture.width,
                                  scale * texture.height, texture, 0)

    arcade.draw_xywh_rectangle_outline(my_button[0],
                                       my_button[1],
                                       my_button[2],
                                       my_button[3],
                                        arcade.color.AERO_BLUE)
예제 #4
0
def help_menu():
    # Draw Help menu(Control)
    arcade.draw_text("How to play",
                     screen_width / 2,
                     580,
                     arcade.color.BLACK,
                     50,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_text("Control", 300, 490, arcade.color.BLACK, 40)
    arcade.draw_text(
        "W: Move Upward \nA: Move Left"
        "\nS: Move Downward \nD: Move Right \n\n"
        "J: Melee Attack \nK: Range Attack", 300, 450, arcade.color.BLACK, 30)
    arcade.draw_xywh_rectangle_outline(sprite_size, sprite_size, sprite_size,
                                       sprite_size, arcade.color.BLACK, 2)
    texture = arcade.load_texture("images/backarrow.png")
    arcade.draw_texture_rectangle(sprite_size * 1.5, sprite_size * 1.5,
                                  sprite_size, sprite_size, texture, 0)
    arcade.draw_xywh_rectangle_outline(screen_width - sprite_size * 2,
                                       sprite_size, sprite_size, sprite_size,
                                       arcade.color.BLACK, 2)
    texture = arcade.load_texture("images/backarrow.png", mirrored=True)
    arcade.draw_texture_rectangle(screen_width - sprite_size * 1.5,
                                  sprite_size * 1.5, sprite_size, sprite_size,
                                  texture, 0)
    def draw_informations(self):
        font_size = self.settings.informations_font_size
        interspace = self.settings.informations_interspace
        delay_text = self.clock.delay if self.clock.delay else "PAUSE"
        infos = [
            f"delay : {delay_text}",
            f"steps : {self.sim.steps}",
            f"state : {self.sim.state}",
        ]
        if self.sim.result:
            infos.append(f"result : {self.sim.result}")

        height = (len(infos) + 4) * interspace
        arcade.draw_text(
            f"Informations :",
            20,
            height - 10 - interspace,
            self.palette.text_color,
            font_size + 2,
        )

        for i, info in enumerate(infos, 3):
            arcade.draw_text(
                info,
                50,
                height - interspace * i,
                self.palette.text_color,
                font_size,
            )

        width = 60 + widest_text_sprite()
        arcade.draw_xywh_rectangle_outline(1, 1, width, height,
                                           self.palette.foreground_color)
예제 #6
0
def death_menu():
    # Draw death menu
    arcade.draw_text("You died",
                     screen_width / 2,
                     screen_height / 2 + 100,
                     arcade.color.BLACK,
                     50,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_text("Return to Menu",
                     screen_width / 2,
                     screen_height / 2 - 12,
                     arcade.color.BLACK,
                     30,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_xywh_rectangle_outline(screen_width / 2 - 175,
                                       screen_height / 2 - 50, 350, 75,
                                       arcade.color.BLACK, 5)
    arcade.draw_text("Revive",
                     screen_width / 2,
                     screen_height / 2 - 112,
                     arcade.color.BLACK,
                     30,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_xywh_rectangle_outline(screen_width / 2 - 175,
                                       screen_height / 2 - 150, 350, 75,
                                       arcade.color.BLACK, 5)
예제 #7
0
def draw_grid():
    arcade.set_background_color(arcade.color.BLACK)
    arcade.draw_xywh_rectangle_outline(1, 0, WIDTH - 1, HEIGHT - 1,
                                       arcade.color.RED)
    for i in range(1, int(WIDTH / 20)):
        arcade.draw_line(i * 20, 0, i * 20, HEIGHT, arcade.color.WHITE)
    for i in range(1, int(HEIGHT / 20)):
        arcade.draw_line(1, i * 20, WIDTH, i * 20, arcade.color.WHITE)
예제 #8
0
    def draw_telemetry(self):
        telemetry = 'скорость: {} \n'.format(self.robot.speed) + \
                    'топливо: {} %\n'.format(round(self.robot.fuel)) + \
                    'в поле: {} \n'.format(len(self.resurse_list)) + \
                    'на борту: {} \n'.format(self.robot.box_current)

        arcade.draw_xywh_rectangle_filled(5, 10, 150, 100, arcade.color.DARK_BLUE_GRAY)
        arcade.draw_xywh_rectangle_outline(5, 10, 150, 100, arcade.color.BLACK, 4)
        arcade.draw_text(telemetry, 10, 15, arcade.color.YELLOW, 16, anchor_x="left")
예제 #9
0
 def draw_health_bar(self):
     arcade.draw_text(f"{self.hungry_level}",
                      self.center_x + self.width / 2, self.center_y,
                      arcade.color.RED, 16)
     arcade.draw_xywh_rectangle_outline(
         self.center_x - 50, self.center_y + 10 + self.height / 2, 100, 10,
         arcade.color.BLACK)
     arcade.draw_xywh_rectangle_filled(self.center_x - 50,
                                       self.center_y + 10 + self.height / 2,
                                       100 - self.hungry_level, 10,
                                       arcade.color.RED)
예제 #10
0
def draw_task(task):
    x1, y1 = task.bottom_left()
    x2, y2 = task.upper_right()
    w, h = x2 - x1, y2 - y1
    ARC.draw_xywh_rectangle_filled(x1, y1, w, h, ARC.color.HELIOTROPE_GRAY)
    ARC.draw_xywh_rectangle_outline(x1, y1, w, h, ARC.color.BLACK, 4)
    ARC.draw_text(str(task.index + 1),
                  x1 + CORE_WIDTH / 2,
                  y1 + (int(task.length / 2) + 1) * TICK_HEIGHT,
                  ARC.color.BLACK,
                  12,
                  anchor_x="left",
                  anchor_y="bottom")
예제 #11
0
def on_draw(player):
    arcade.start_render()
    arcade.set_background_color(arcade.color.WHITE)
    arcade.draw_text("Balls", 20, 570, arcade.color.BLACK, 50)
    arcade.draw_text("Balls Known:", 20, 520, arcade.color.BLACK, 30)
    arcade.draw_text(str(len(player.ball_list)), 250, 520, arcade.color.BLACK,
                     30)
    arcade.draw_text("Q - Sort", 30, 30, arcade.color.BLACK, 60)
    arcade.draw_text("E - Search", 370, 30, arcade.color.BLACK, 60)

    arcade.draw_xywh_rectangle_outline(10, 405, 450, 70, arcade.color.GRAY, 3)
    arcade.draw_xywh_rectangle_outline(5, 290, 460, 90, arcade.color.BLACK, 5)
    arcade.draw_xywh_rectangle_outline(10, 193, 450, 70, arcade.color.GRAY, 3)

    if player.get_pointer() - 1 != -1:
        arcade.draw_text(
            "{}: {}".format(player.ball_list[player.get_pointer() - 1].name,
                            player.ball_list[player.get_pointer() - 1].effect),
            20, 425, arcade.color.BLACK, 20)

    arcade.draw_text(
        "{}: {}".format(player.ball_list[player.get_pointer()].name,
                        player.ball_list[player.get_pointer()].effect), 20,
        320, arcade.color.BLACK, 30)

    if player.get_pointer() + 1 != len(player.ball_list):
        arcade.draw_text(
            "{}: {}".format(player.ball_list[player.get_pointer() + 1].name,
                            player.ball_list[player.get_pointer() + 1].effect),
            20, 213, arcade.color.BLACK, 20)

    arcade.draw_triangle_filled(475, 335, 495, 315, 495, 355,
                                arcade.color.BLACK)
    arcade.draw_xywh_rectangle_outline(500, 210, 250, 250, arcade.color.BLACK,
                                       10)
    arcade.draw_texture_rectangle(
        625, 335, 240, 240, player.ball_list[player.get_pointer()].texture)
    arcade.draw_text(
        "Amount: {}".format(str(
            player.ball_list[player.get_pointer()].amount)), 465, 150,
        arcade.color.BLACK, 50)

    if player.search_menu:
        arcade.draw_xywh_rectangle_filled(100, 100, 568, 440,
                                          arcade.color.BLACK)
        arcade.draw_xywh_rectangle_filled(110, 110, 548, 420,
                                          arcade.color.WHITE)
        arcade.draw_text("Enter Item First Letter:", 140, 450,
                         arcade.color.BLACK, 35)
        arcade.draw_text(" " + player.search_letter, 140, 200,
                         arcade.color.BLACK, 220)
    if player.sort_menu:
        arcade.draw_xywh_rectangle_filled(100, 100, 568, 440,
                                          arcade.color.BLACK)
        arcade.draw_xywh_rectangle_filled(110, 110, 548, 420,
                                          arcade.color.WHITE)
        arcade.draw_text("Do you want to sort", 175, 380, arcade.color.BLACK,
                         40)
        arcade.draw_text("the balls by least amount?", 130, 310,
                         arcade.color.BLACK, 40)
예제 #12
0
def on_draw(player: arcade.Window):
    arcade.start_render()
    arcade.draw_text("Buffs", 20, 570, arcade.color.BLACK, 50)
    arcade.draw_text("Item Count:", 20, 520, arcade.color.BLACK, 30)
    arcade.draw_text(str(len(player.buff_list)), 250, 520, arcade.color.BLACK,
                     30)
    arcade.draw_text("Q - Sort", 30, 30, arcade.color.BLACK, 60)
    arcade.draw_text("E - Search", 370, 30, arcade.color.BLACK, 60)

    arcade.draw_xywh_rectangle_outline(10, 405, 450, 70, arcade.color.GRAY, 3)
    arcade.draw_xywh_rectangle_outline(5, 290, 460, 90, arcade.color.BLACK, 5)
    arcade.draw_xywh_rectangle_outline(10, 193, 450, 70, arcade.color.GRAY, 3)

    if player.get_pointer() - 1 != -1:
        arcade.draw_text(
            "{}: {}".format(player.buff_list[player.get_pointer() - 1].name,
                            player.buff_list[player.get_pointer() - 1].effect),
            20, 425, arcade.color.BLACK, 20)

    arcade.draw_text(
        "{}: {}".format(player.buff_list[player.get_pointer()].name,
                        player.buff_list[player.get_pointer()].effect), 20,
        320, arcade.color.BLACK, 20)

    if player.get_pointer() + 1 != len(player.buff_list):
        arcade.draw_text(
            "{}: {}".format(player.buff_list[player.get_pointer() + 1].name,
                            player.buff_list[player.get_pointer() + 1].effect),
            20, 213, arcade.color.BLACK, 20)

    arcade.draw_triangle_filled(475, 335, 495, 315, 495, 355,
                                arcade.color.BLACK)
    arcade.draw_xywh_rectangle_outline(500, 210, 250, 250, arcade.color.BLACK,
                                       10)
    arcade.draw_texture_rectangle(
        625, 335, 240, 240, player.buff_list[player.get_pointer()].texture)
    arcade.draw_text(
        "Amount: {}".format(str(
            player.buff_list[player.get_pointer()].amount)), 465, 150,
        arcade.color.BLACK, 50)

    if player.search_menu:
        arcade.draw_xywh_rectangle_filled(100, 100, 568, 440,
                                          arcade.color.BLACK)
        arcade.draw_xywh_rectangle_filled(110, 110, 548, 420,
                                          arcade.color.WHITE)
        arcade.draw_text("Enter Pokemon Number:", 140, 450, arcade.color.BLACK,
                         35)
        arcade.draw_text(" " + player.search_number, 140, 200,
                         arcade.color.BLACK, 220)
    if player.sort_menu:
        arcade.draw_xywh_rectangle_filled(100, 100, 568, 440,
                                          arcade.color.BLACK)
        arcade.draw_xywh_rectangle_filled(110, 110, 548, 420,
                                          arcade.color.WHITE)
        arcade.draw_text("Do you want to sort", 115, 380, arcade.color.BLACK,
                         50)
        arcade.draw_text("the bag?", 175, 310, arcade.color.BLACK, 50)
    def draw_status_icons(self):
        y = 0
        x = 34
        icon_pos_x = self.states_panel_line
        icon_pos_y = self.side_panel_y_line + self.skill_panel_height - 32
        if self.player.fighter.states:
            # 状態変化枠背景
            arcade.draw_xywh_rectangle_filled(
                bottom_left_x=self.states_panel_line,
                bottom_left_y=self.side_panel_y_line,
                width=STATES_PANEL_WIDTH + 10,
                height=self.skill_panel_height + 3,
                color=(25, 25, 25, 55))
            # 状態変化ステータス枠
            arcade.draw_xywh_rectangle_outline(
                bottom_left_x=self.states_panel_line,
                bottom_left_y=self.side_panel_y_line,
                width=STATES_PANEL_WIDTH + 10,
                height=self.skill_panel_height + 3,
                color=arcade.color.YELLOW_ROSE,
                border_width=self.panel_line_width)
        for i in range(len(self.player.fighter.states)):
            icon = self.player.fighter.states[i].icon[0]

            arcade.draw_texture_rectangle(center_x=icon_pos_x + x,
                                          center_y=icon_pos_y + y,
                                          width=40,
                                          height=40,
                                          texture=IMAGE_ID["black_board"])
            arcade.draw_texture_rectangle(center_x=icon_pos_x + x,
                                          center_y=icon_pos_y + y,
                                          width=40,
                                          height=40,
                                          texture=icon)
            if i < 2:
                x += GRID_SIZE
            elif i == 2:
                x = 34
                y -= 58
            elif i < 5:
                x += GRID_SIZE
            elif i == 5:
                x = 34
                y -= 58
            elif i < 9:
                x += GRID_SIZE
def on_draw(player):
    arcade.start_render()
    arcade.draw_text("Pokedex", 20, 570, arcade.color.BLACK, 50)
    arcade.draw_text("Total Caught:", 20, 520, arcade.color.BLACK, 30)
    arcade.draw_text(str(len(player.poke_list)), 250, 520, arcade.color.BLACK,
                     30)
    arcade.draw_text("Q - Sort", 30, 30, arcade.color.BLACK, 60)
    arcade.draw_text("E - Search", 370, 30, arcade.color.BLACK, 60)

    arcade.draw_xywh_rectangle_filled(0, 173, 768, 320, arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(10, 405, 450, 70, arcade.color.GRAY, 3)
    arcade.draw_xywh_rectangle_outline(5, 290, 460, 90, arcade.color.BLACK, 5)
    arcade.draw_xywh_rectangle_outline(10, 193, 450, 70, arcade.color.GRAY, 3)

    if player.get_pointer() - 1 != -1:
        arcade.draw_text(
            "{}: {}".format(player.poke_list[player.get_pointer() - 1].num,
                            player.poke_list[player.get_pointer() - 1].name),
            20, 425, arcade.color.BLACK, 20)

    arcade.draw_text(
        "{}: {}".format(player.poke_list[player.get_pointer()].num,
                        player.poke_list[player.get_pointer()].name), 20, 320,
        arcade.color.BLACK, 30)

    if player.get_pointer() + 1 != len(player.poke_list):
        arcade.draw_text(
            "{}: {}".format(player.poke_list[player.get_pointer() + 1].num,
                            player.poke_list[player.get_pointer() + 1].name),
            20, 213, arcade.color.BLACK, 20)

    arcade.draw_triangle_filled(475, 335, 495, 315, 495, 355,
                                arcade.color.BLACK)
    arcade.draw_xywh_rectangle_outline(500, 210, 250, 250, arcade.color.BLACK,
                                       10)
    arcade.draw_texture_rectangle(
        625, 335, 240, 240, player.poke_list[player.get_pointer()].texture)

    if player.search_menu:
        arcade.draw_xywh_rectangle_filled(100, 100, 568, 440,
                                          arcade.color.BLACK)
        arcade.draw_xywh_rectangle_filled(110, 110, 548, 420,
                                          arcade.color.WHITE)
        arcade.draw_text("Enter Pokemon Number:", 140, 450, arcade.color.BLACK,
                         35)
        arcade.draw_text(" " + player.search_number, 140, 200,
                         arcade.color.BLACK, 220)
    if player.sort_menu:
        arcade.draw_xywh_rectangle_filled(100, 100, 568, 440,
                                          arcade.color.BLACK)
        arcade.draw_xywh_rectangle_filled(110, 110, 548, 420,
                                          arcade.color.WHITE)
        arcade.draw_text("Do you want to sort", 115, 380, arcade.color.BLACK,
                         50)
        arcade.draw_text("the Pokedex?", 175, 310, arcade.color.BLACK, 50)
def on_draw(player):
    arcade.start_render()
    arcade.set_background_color(arcade.color.WHITE)
    arcade.draw_text("GAME MENU",
                     384,
                     608,
                     arcade.color.BLACK,
                     50,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")

    arcade.draw_xywh_rectangle_outline(42, 295, 325, 250, player.dex_color, 5)
    arcade.draw_text("POKEDEX",
                     204,
                     480,
                     player.dex_color,
                     45,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_texture_rectangle(192, 380, 190, 140, player.dex_sprite)

    arcade.draw_xywh_rectangle_outline(401, 295, 325, 250, player.bag_color, 5)
    arcade.draw_text("BAG",
                     564,
                     480,
                     player.bag_color,
                     45,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_texture_rectangle(556, 380, 190, 140, player.bag_sprite)

    arcade.draw_xywh_rectangle_outline(42, 20, 325, 250, player.save_color, 5)
    arcade.draw_text("SAVE",
                     204,
                     200,
                     player.save_color,
                     45,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_texture_rectangle(192, 91, 190, 140, player.save_sprite)

    arcade.draw_xywh_rectangle_outline(401, 20, 325, 250, player.exit_color, 5)
    arcade.draw_text("EXIT",
                     564,
                     200,
                     player.exit_color,
                     45,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_texture_rectangle(556, 91, 150, 100, player.exit_sprite)
    def draw_instructions(self):
        font_size = self.settings.informations_font_size
        interspace = self.settings.instructions_interspace
        n = self.input_handler.number_of_bindings()

        arcade.draw_text(
            f"Instructions :",
            20,
            self.height - 10 - interspace,
            self.palette.text_color,
            font_size + 2,
        )
        max_key_size = max(len(b.key) for b in self.input_handler.bindings) + 2

        for i, b in enumerate(self.input_handler.bindings, 3):
            arcade.draw_text(
                f"{b.key:^{max_key_size}} {b.description}",
                50,
                self.height - interspace * i,
                self.palette.text_color,
                font_size,
            )
        arcade.draw_text(
            "You can drag and drop the tapes with the mouse left click",
            30,
            self.height - 10 - interspace * (n + 3),
            self.palette.text_color,
            font_size,
        )
        arcade.draw_text(
            "You can scroll to zoom in / out",
            30,
            self.height - 10 - interspace * (n + 4),
            self.palette.text_color,
            font_size,
        )
        width = 60 + widest_text_sprite()
        height = (n + 5) * interspace
        arcade.draw_xywh_rectangle_outline(
            1,
            self.height - height,
            width,
            height - 1,
            self.palette.foreground_color,
        )
def draw_button() -> None:
    """Drawing buttons that using can click"""
    arcade.draw_xywh_rectangle_outline(20, 530, 140, 50, arcade.color.BLACK, 3)
    arcade.draw_text("Prev Page",
                     90,
                     555,
                     arcade.color.BLACK,
                     25,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")

    arcade.draw_xywh_rectangle_outline(380, 530, 140, 50, arcade.color.BLACK,
                                       3)
    arcade.draw_text("Next Page",
                     450,
                     555,
                     arcade.color.BLACK,
                     25,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")

    for i in range(9):
        arcade.draw_xywh_rectangle_outline(20 + i % 3 * 175,
                                           370 - i // 3 * 175, 150, 150,
                                           arcade.color.BLACK, 2)
예제 #18
0
def help_menu_2():
    arcade.draw_text("How to play",
                     screen_width / 2,
                     580,
                     arcade.color.BLACK,
                     50,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_text("Gameplay", 300, 490, arcade.color.BLACK, 40)
    arcade.draw_text(
        "Player statistic on top part of the screen \n"
        "Player starts out with no weapon \n"
        "Go to top left of start to get weapons \n"
        "Kill Enemy to get coins \n"
        "Walk over item to buy them at shop"
        "\n\nDefeat the Boss to win", 300, 450, arcade.color.BLACK, 30)
    arcade.draw_xywh_rectangle_outline(sprite_size, sprite_size, sprite_size,
                                       sprite_size, arcade.color.BLACK, 2)
    texture = arcade.load_texture("images/backarrow.png")
    arcade.draw_texture_rectangle(sprite_size * 1.5, sprite_size * 1.5,
                                  sprite_size, sprite_size, texture, 0)
예제 #19
0
 def draw(self):
     if self.enablebutton:
         if self.filled:
             if self.buttontype == "standard":
                 arcade.draw_rectangle_filled(self.x, self.y, self.w,
                                              self.h, self.color)
             elif self.buttontype == "ltrb":
                 arcade.draw_lrtb_rectangle_filled(self.x, self.y, self.w,
                                                   self.h, self.color)
             elif self.buttontype == "xywh":
                 arcade.draw_xywh_rectangle_filled(self.x, self.y, self.w,
                                                   self.h, self.color)
         if not self.filled:
             if self.buttontype == "standard":
                 arcade.draw_rectangle_outline(self.x, self.y, self.w,
                                               self.h, self.color)
             elif self.buttontype == "ltrb":
                 arcade.draw_lrtb_rectangle_outline(self.x, self.y, self.w,
                                                    self.h, self.color)
             elif self.buttontype == "xywh":
                 arcade.draw_xywh_rectangle_outline(self.x, self.y, self.w,
                                                    self.h, self.color)
         if self.displaytext:
             arcade.draw_text(*self._text_args, **self._text_kwargs)
예제 #20
0
def on_draw(player: arcade.Window):
    arcade.start_render()
    arcade.draw_text("Potion", 20, 570, arcade.color.BLACK, 50)
    arcade.draw_text("Q - Sort", 30, 30, arcade.color.BLACK, 60)

    arcade.draw_xywh_rectangle_outline(10, 405, 450, 70, arcade.color.GRAY, 3)
    arcade.draw_xywh_rectangle_outline(5, 290, 460, 90, arcade.color.BLACK, 5)
    arcade.draw_xywh_rectangle_outline(10, 193, 450, 70, arcade.color.GRAY, 3)

    if player.get_pointer() - 1 != -1:
        arcade.draw_text(
            "{}: {}".format(player.heal_list[player.get_pointer() - 1].name,
                            player.heal_list[player.get_pointer() - 1].effect),
            20, 425, arcade.color.BLACK, 20)

    arcade.draw_text(
        "{}: {}".format(player.heal_list[player.get_pointer()].name,
                        player.heal_list[player.get_pointer()].effect), 20,
        320, arcade.color.BLACK, 30)

    if player.get_pointer() + 1 != len(player.heal_list):
        arcade.draw_text(
            "{}: {}".format(player.heal_list[player.get_pointer() + 1].name,
                            player.heal_list[player.get_pointer() + 1].effect),
            20, 213, arcade.color.BLACK, 20)

    arcade.draw_triangle_filled(475, 335, 495, 315, 495, 355,
                                arcade.color.BLACK)
    arcade.draw_xywh_rectangle_outline(500, 210, 250, 250, arcade.color.BLACK,
                                       10)
    arcade.draw_texture_rectangle(
        625, 335, 240, 240, player.heal_list[player.get_pointer()].texture)
    arcade.draw_text(
        "Amount: {}".format(str(
            player.heal_list[player.get_pointer()].amount)), 465, 150,
        arcade.color.BLACK, 50)

    if player.sort_menu:
        arcade.draw_xywh_rectangle_filled(100, 100, 568, 440,
                                          arcade.color.BLACK)
        arcade.draw_xywh_rectangle_filled(110, 110, 548, 420,
                                          arcade.color.WHITE)
        arcade.draw_text("Do you want to sort", 115, 380, arcade.color.BLACK,
                         50)
        arcade.draw_text("by hp healed?", 175, 310, arcade.color.BLACK, 50)
    def panel_ui(self):
        # 画面下のパネルをarcadeの四角形を描画する変数で作成
        arcade.draw_xywh_rectangle_filled(bottom_left_x=self.viewport_left,
                                          bottom_left_y=self.viewport_bottom,
                                          width=self.buttom_panel_width,
                                          height=STATES_PANEL_HEIGHT,
                                          color=arcade.color.BLACK)

        # 下パネルの周りの線
        arcade.draw_xywh_rectangle_outline(
            bottom_left_x=self.viewport_left + self.panel_line_width * 0.5,
            bottom_left_y=self.viewport_bottom + self.panel_line_width * 0.5,
            width=self.buttom_panel_width - self.panel_line_width,
            height=STATES_PANEL_HEIGHT,
            color=arcade.color.BLACK,
            border_width=self.panel_line_width)

        # 画面横のパネル
        arcade.draw_xywh_rectangle_filled(bottom_left_x=self.viewport_left +
                                          SCREEN_WIDTH - STATES_PANEL_WIDTH,
                                          bottom_left_y=self.viewport_bottom,
                                          width=STATES_PANEL_WIDTH,
                                          height=SCREEN_HEIGHT,
                                          color=arcade.color.BLACK)

        # 横パネルの周りの線
        arcade.draw_xywh_rectangle_outline(
            bottom_left_x=self.viewport_left + SCREEN_WIDTH -
            STATES_PANEL_WIDTH + self.panel_line_width * 0.5,
            bottom_left_y=self.viewport_bottom + self.panel_line_width * 0.5,
            width=STATES_PANEL_WIDTH - self.panel_line_width,
            height=SCREEN_HEIGHT - self.panel_line_width - 231,
            color=arcade.color.BLACK,
            border_width=self.panel_line_width)

        # ミニマップ囲い線
        arcade.draw_xywh_rectangle_outline(
            bottom_left_x=self.viewport_left + SCREEN_WIDTH -
            STATES_PANEL_WIDTH + self.panel_line_width * 0.5,
            bottom_left_y=self.viewport_bottom + SCREEN_HEIGHT - 228,
            width=STATES_PANEL_WIDTH - self.panel_line_width,
            height=225,
            color=arcade.color.BLACK,
            border_width=self.panel_line_width)
예제 #22
0
def draw_instructions():
    arcade.set_background_color(arcade.color.BLACK)
    arcade.draw_text("Instructions",
                     HEIGHT / 60,
                     WIDTH / 2,
                     arcade.color.WHITE,
                     font_name="garamond",
                     font_size=10)
    arcade.draw_xywh_rectangle_outline(510, 260, 100, 100, arcade.color.WHITE)
    arcade.draw_text("R",
                     HEIGHT - 155,
                     WIDTH / 4.5,
                     arcade.color.WHITE,
                     font_name="garamond",
                     font_size=10)
    arcade.draw_xywh_rectangle_outline(630, 260, 100, 100, arcade.color.WHITE)
    arcade.draw_text("P",
                     HEIGHT - 34,
                     WIDTH / 4.5,
                     arcade.color.WHITE,
                     font_name="garamond",
                     font_size=10)
    arcade.draw_xywh_rectangle_outline(750, 260, 100, 100, arcade.color.WHITE)
    arcade.draw_text("S",
                     HEIGHT + 85,
                     WIDTH / 4.5,
                     arcade.color.WHITE,
                     font_name="garamond",
                     font_size=10)
    arcade.draw_text("Select from the keys:",
                     HEIGHT - 105,
                     WIDTH / 3.6,
                     arcade.color.WHITE,
                     font_name="garamond",
                     font_size=14)
    arcade.draw_text("Press ESC to go back",
                     HEIGHT + 525,
                     WIDTH / 2,
                     arcade.color.WHITE,
                     font_name="garamond",
                     font_size=10)
예제 #23
0
파일: Demo.py 프로젝트: Ti1mmy/classwork
def on_draw():

    global pressure
    global power_output
    global decreasing_pressure
    global decreasing_power

    # Logic:
    # Pressure
    if pressure == 0:
        decreasing_pressure = False
    if not decreasing_pressure:
        pressure += 3
    if pressure == 165:
        decreasing_pressure = True
    if decreasing_pressure:
        pressure -= 55

    # Power
    if power_output == 0:
        decreasing_power = False
    if pressure == 18:
        decreasing_power = False
    if not decreasing_power and pressure > 21:
        power_output += 2
    if pressure == 55:
        decreasing_power = True
    if decreasing_power:
        power_output = (power_output // 3)
    print(power_output)

    arcade.start_render()

    # Loading Sprites
    # General
    arrow = arcade.load_texture('arrow.png', 0, 0, 512, 512)

    # Graphs
    barometer = arcade.load_texture('barometer.png', 0, 0, 512, 512)
    power = arcade.load_texture('electricity.png', 0, 0, 2273, 2400)

    # Container
    liquid = arcade.load_texture('liquid.png', 0, 0, 1600, 450)

    # Gas
    gas = arcade.load_texture('gas.png', 0, 0, 512, 512)

    # Condensation
    drop = arcade.load_texture('condensation.png', 0, 0, 400, 428)

    # Graphs
    arcade.draw_line(950, 525, 1150, 525, arcade.color.BLACK, 1)  # x - axis
    arcade.draw_line(950, 525, 950, 690, arcade.color.BLACK, 1)  # y - axis
    arcade.draw_texture_rectangle(990, 505, 30, 30, barometer)  # Pressure
    arcade.draw_texture_rectangle(1100, 505, 30, 30, power)  # Power output

    # Bars
    arcade.draw_line(990, 525, 990, 526 + pressure, arcade.color.BLUE, 25)
    arcade.draw_line(1100, 525, 1100, 526 + power_output, arcade.color.RED, 25)

    # Container
    arcade.draw_texture_rectangle(250, 235, 200, 110, liquid)  # Liquid
    arcade.draw_rectangle_filled(
        250, 180, 200, 35,
        arcade.color.WHITE)  # Covers the bit that extends too much
    arcade.draw_xywh_rectangle_outline(150, 200, 200, 120, arcade.color.BLACK,
                                       7)
    arcade.draw_rectangle_outline(250, 251, 400, 27, arcade.color.BLACK, 7)

    # Temperature Gradient for Water
    x_gradient = 51
    red = 255
    blue = 0
    for i in range(200):
        arcade.draw_line(x_gradient, 238, x_gradient, 264, [red, 0, blue], 2)
        x_gradient += 2
        red -= 0.6375 * 2
        blue += 0.6375 * 2

    # Radiator
    x_radiator = 175
    for i in range(7):
        arcade.draw_line(x_radiator, 225, x_radiator, 280, arcade.color.BLACK,
                         5)
        x_radiator += 25

    # Water Direction Arrows
    arcade.draw_texture_rectangle(25, 250, 40, 40, arrow)
    arcade.draw_texture_rectangle(475, 250, 40, 40, arrow)

    # Gas
    arcade.draw_texture_rectangle(random.randint(175, 345),
                                  random.randint(290, 300), 25, 25, gas)

    # Actual Power Generation Part
    arcade.draw_xywh_rectangle_outline(150, 400, 200, 120, arcade.color.BLACK,
                                       7)  # Piston Section 1
    arcade.draw_rectangle_outline(250, 360, 50, 75, arcade.color.BLACK,
                                  7)  # Tubing
    arcade.draw_rectangle_filled(250, 360, 43, 87,
                                 arcade.color.WHITE)  # Removing Lines

    # Piston
    y_piston = (pressure / 165) * 45
    arcade.draw_xywh_rectangle_filled(154, 402, 193, 70,
                                      arcade.color.LIGHT_BLUE)  # 'Gas'
    arcade.draw_xywh_rectangle_filled(154, (402 + y_piston), 193, 70,
                                      arcade.color.LIGHT_GRAY)  # Piston
    arcade.draw_xywh_rectangle_filled(
        154, (416 + y_piston), 193, 20,
        arcade.color.GRAY)  # Gasket to prevent leaking

    # Shaft
    arcade.draw_rectangle_filled(250.5, (545 + y_piston), 30, 150,
                                 arcade.color.LIGHT_GRAY)

    # Pressure Release things
    arcade.draw_xywh_rectangle_outline(
        400, 400, 400, 120, arcade.color.BLACK,
        7)  # Release container (more volume than the storage container
    arcade.draw_xywh_rectangle_outline(350, 425, 70, 15, arcade.color.BLACK,
                                       7)  # Connecting tube
    if decreasing_pressure:
        arcade.draw_rectangle_filled(400, 432, 20, 8,
                                     arcade.color.WHITE)  # Valve Open Close
        # Water drops -> Condensation
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
        arcade.draw_texture_rectangle(random.randint(410, 780),
                                      random.randint(410, 460), 20, 25, drop)
    arcade.draw_line(320, 280, 410, 400, arcade.color.BLACK, 8)  # Refill tube

    # Pressure Bar

    arcade.draw_rectangle_outline(1000, 250, 40, 370, arcade.color.BLACK,
                                  7)  # Bar outline
    arcade.draw_texture_rectangle(
        960, 390, 20, 20, arrow)  # arrow is positioned at 330 because 2x 165
    # Gradient for pressure. Green  = low pressure, red = high pressure
    red = 0
    green = 255
    blue = 0
    y_gradient = 68
    for i in range(pressure):
        arcade.draw_line(983, y_gradient, 1016, y_gradient, [red, green, blue],
                         2)
        y_gradient += 2
        red += 1.54
        green -= 1.54

    if pressure % 55 == 0:
        arcade.draw_text('Valve Open', 575, 680, arcade.color.RED,
                         20)  # Indicates if valve is open or closed
예제 #24
0
def on_draw():
    global pressure
    global power_output
    global decreasing_pressure
    global decreasing_power

    # Logic:
    # Pressure

    if pressure == 0:
        decreasing_pressure = False
    if not decreasing_pressure:
        pressure += 3
    if pressure == 165:
        decreasing_pressure = True
    if decreasing_pressure:
        pressure -= 55

    # Power
    if power_output == 0:
        decreasing_power = False
    if pressure == 18:
        decreasing_power = False
    if not decreasing_power and pressure > 21:
        power_output += 2
    if pressure == 55:
        decreasing_power = True
    if decreasing_power:
        power_output = (power_output // 3)
    print(power_output)

    arcade.start_render()

    # Loading Sprites
    # General
    arrow = arcade.load_texture('arrow.png', 0, 0, 512, 512)

    # Graphs
    barometer = arcade.load_texture('barometer.png', 0, 0, 512, 512)
    power = arcade.load_texture('electricity.png', 0, 0, 2273, 2400)

    # Container
    liquid = arcade.load_texture('liquid.png', 0, 0, 1600, 450)

    # Gas
    gas = arcade.load_texture('gas.png', 0, 0, 512, 512)

    # Graphs
    arcade.draw_line(950, 525, 1150, 525, arcade.color.BLACK, 1)  # x - axis
    arcade.draw_line(950, 525, 950, 690, arcade.color.BLACK, 1)  # y - axis
    arcade.draw_texture_rectangle(990, 505, 30, 30, barometer)  # Pressure
    arcade.draw_texture_rectangle(1100, 505, 30, 30, power)  # Power output

    # Bars
    arcade.draw_line(990, 525, 990, 526 + pressure, arcade.color.BLUE, 25)
    arcade.draw_line(1100, 525, 1100, 526 + power_output, arcade.color.RED, 25)

    # Container
    arcade.draw_texture_rectangle(250, 235, 200, 110, liquid)  # Liquid
    arcade.draw_rectangle_filled(
        250, 180, 200, 35,
        arcade.color.WHITE)  # Covers the bit that extends too much
    arcade.draw_xywh_rectangle_outline(150, 200, 200, 120, arcade.color.BLACK,
                                       7)
    arcade.draw_rectangle_outline(250, 251, 400, 27, arcade.color.BLACK, 7)

    # Temperature Gradient for Water
    x_gradient = 51
    red = 255
    blue = 0
    for i in range(200):
        arcade.draw_line(x_gradient, 238, x_gradient, 264, [red, 0, blue], 2)
        x_gradient += 2
        red -= 0.6375 * 2
        blue += 0.6375 * 2

    # Radiator
    x_radiator = 175
    for i in range(7):
        arcade.draw_line(x_radiator, 225, x_radiator, 280, arcade.color.BLACK,
                         5)
        x_radiator += 25

    # Water Direction Arrows
    arcade.draw_texture_rectangle(25, 250, 40, 40, arrow)
    arcade.draw_texture_rectangle(475, 250, 40, 40, arrow)

    # Gas
    arcade.draw_texture_rectangle(random.randint(175, 345),
                                  random.randint(290, 300), 25, 25, gas)

    # Actual Power Generation Part
    arcade.draw_xywh_rectangle_outline(150, 400, 200, 120, arcade.color.BLACK,
                                       7)  # Piston Section 1
    arcade.draw_rectangle_outline(250, 360, 50, 75, arcade.color.BLACK,
                                  7)  # Tubing
    arcade.draw_rectangle_filled(250, 360, 43, 87,
                                 arcade.color.WHITE)  # Removing Lines

    # Piston Movement

    # Pressure Bar

    arcade.draw_rectangle_outline(600, 450, 40, 370, arcade.color.BLACK, 7)
    arcade.draw_texture_rectangle(
        550, 598, 20, 20, arrow)  # arrow is positioned at 330 because 2x 165
    # Gradient
    red = 0
    green = 255
    blue = 0
    y_gradient = 268.5
    for i in range(pressure):
        arcade.draw_line(583.5, y_gradient, 616.5, y_gradient,
                         [red, green, blue], 2)
        y_gradient += 2
        red += 1.54
        green -= 1.54

    if pressure % 55 == 0:
        arcade.draw_text('Valve Open', 575, 680, arcade.color.RED, 20)
def on_draw(game: "arcade.Window") -> None:
    """Drawing information on screen"""
    arcade.start_render()
    arcade.draw_text("Pokemon Storage",
                     width / 2,
                     height - 20,
                     arcade.color.BLACK,
                     40,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_text(f"Page: {game.sto_page}",
                     270,
                     555,
                     arcade.color.BLACK,
                     30,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_text("Q to sort by #", 540, 60, arcade.color.BLACK, 20)
    arcade.draw_text("E to search by #", 540, 40, arcade.color.BLACK, 20)

    draw_pokemon(game)
    draw_button()

    # Display pokemon stats
    if game.sto_selected is not None:
        arcade.draw_text(game.sto_selected.name, 540, 480, arcade.color.BLACK,
                         20)
        arcade.draw_text(f"# {game.sto_selected.num}", 540, 460,
                         arcade.color.BLACK, 20)
        arcade.draw_text(f"lvl: {game.sto_selected.lvl}", 540, 440,
                         arcade.color.BLACK, 20)
        arcade.draw_text(
            f"hp: {game.sto_selected.cur_stats[0]}/"
            f"{game.sto_selected.stats[0]}", 540, 420, arcade.color.BLACK, 20)
        arcade.draw_text(f"atk: {game.sto_selected.stats[1]}", 540, 400,
                         arcade.color.BLACK, 20)
        arcade.draw_text(f"def: {game.sto_selected.stats[2]}", 540, 380,
                         arcade.color.BLACK, 20)
        arcade.draw_text(f"spd: {game.sto_selected.stats[3]}", 540, 360,
                         arcade.color.BLACK, 20)
        arcade.draw_xywh_rectangle_outline(540, 300, 200, 50,
                                           arcade.color.BLACK, 3)
        arcade.draw_text("Send to bag",
                         640,
                         325,
                         arcade.color.BLACK,
                         24,
                         align="center",
                         anchor_x="center",
                         anchor_y="center")
        if len(game.player_sprite.pokemon) >= 6:
            arcade.draw_text("bag is full", 540, 270, arcade.color.BLACK, 20)
    else:
        arcade.draw_text("No Pokemon Selected", 540, 480, arcade.color.BLACK,
                         20)

    if game.sto_searching:
        arcade.draw_text("K to stop searching", 540, 560, arcade.color.BLACK,
                         20)
        arcade.draw_text(f"Searching for", 540, 530, arcade.color.BLACK, 20)
        arcade.draw_text(f"pokemon #{game.sto_search_number}", 540, 510,
                         arcade.color.BLACK, 20)
    else:
        arcade.draw_text("K to leave", 540, 20, arcade.color.BLACK, 20)
def on_draw(game):
    # Draw Main menu
    arcade.set_background_color(arcade.color.WHITE)
    arcade.draw_text("Pokemon",
                     game.width / 2,
                     480,
                     arcade.color.BLACK,
                     70,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    # start button v
    arcade.draw_text("Start New Game",
                     game.width / 2,
                     game.height / 2 + 63 - game.start_y,
                     arcade.color.BLACK,
                     30,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")

    if (game.width / 2 + 150 > game.mouse_x > game.width / 2 - 150
            and game.height / 2 + 100 - game.start_y > game.mouse_y >
            game.height / 2 + 25 - game.start_y):
        arcade.draw_xywh_rectangle_outline(
            game.width / 2 - 150 - 4, game.height / 2 + 25 - 4 - game.start_y,
            300 + 8, 75 + 8, arcade.color.RED, 7)
    else:
        arcade.draw_xywh_rectangle_outline(game.width / 2 - 150,
                                           game.height / 2 + 25 - game.start_y,
                                           300, 75, arcade.color.BLACK, 5)

    # start button ^ load button v
    if game.load is False:
        arcade.draw_text("Load Game",
                         game.width / 2,
                         game.height / 2 + 63 - 125 - game.start_y,
                         arcade.color.GRAY,
                         30,
                         align="center",
                         anchor_x="center",
                         anchor_y="center")

        arcade.draw_xywh_rectangle_outline(
            game.width / 2 - 150, game.height / 2 - 100 - game.start_y, 300,
            75, arcade.color.GRAY, 5)

        arcade.draw_xywh_rectangle_outline(
            game.width / 2 - 75 / 2, game.height / 2 - 225 - game.start_y, 75,
            75, arcade.color.GRAY, 5)

    else:
        arcade.draw_text("Load Game",
                         game.width / 2,
                         game.height / 2 + 63 - 125 - game.start_y,
                         arcade.color.BLACK,
                         30,
                         align="center",
                         anchor_x="center",
                         anchor_y="center")

        if (game.width / 2 + 150 > game.mouse_x > game.width / 2 - 150 and
                game.height / 2 - 25 > game.mouse_y > game.height / 2 - 100):
            arcade.draw_xywh_rectangle_outline(
                game.width / 2 - 150 - 4,
                game.height / 2 - 100 - 4 - game.start_y, 300 + 8, 75 + 8,
                arcade.color.RED, 7)

        else:
            arcade.draw_xywh_rectangle_outline(
                game.width / 2 - 150, game.height / 2 - 100 - game.start_y,
                300, 75, arcade.color.BLACK, 5)

        if (game.width / 2 + 75 / 2 > game.mouse_x > game.width / 2 - 75 / 2
                and
                game.height / 2 - 150 > game.mouse_y > game.height / 2 - 225):
            arcade.draw_xywh_rectangle_outline(
                game.width / 2 - 75 / 2 - 4,
                game.height / 2 - 225 - 4 - game.start_y, 75 + 8, 75 + 8,
                arcade.color.RED, 7)

        else:
            arcade.draw_xywh_rectangle_outline(
                game.width / 2 - 75 / 2, game.height / 2 - 225 - game.start_y,
                75, 75, arcade.color.BLACK, 5)
예제 #27
0
def on_draw():
    global x, y, score
    arcade.start_render()
    # Draw in here...
    if current_screen == "menu":
        arcade.draw_text("HOPPY HELICOPTER",
                         HEIGHT / 2 - 100,
                         WIDTH / 4,
                         arcade.color.BLACK,
                         font_size=60,
                         font_name="garamond")
        arcade.draw_text("Press space to play",
                         HEIGHT / 2 - 100,
                         WIDTH / 4.5,
                         arcade.color.BLACK,
                         font_name="garamond")
        arcade.draw_text("Press I to read instructions",
                         HEIGHT / 2 - 100,
                         WIDTH / 5.5,
                         arcade.color.BLACK,
                         font_name="garamond")
        arcade.draw_text("Press ENTER to switch to Ghost Mode(Very Hard)",
                         HEIGHT / 2 - 100,
                         WIDTH / 5,
                         arcade.color.BLACK,
                         font_name="garamond")
        arcade.draw_text("Press ESC to Quit",
                         HEIGHT / 2 - 100,
                         WIDTH / 6,
                         arcade.color.BLACK,
                         font_name="garamond")
        arcade.set_background_color(arcade.color.LIGHT_BLUE)
        draw_helicopter(x, y)
        draw_helicopter3(xx, y)

    elif current_screen == "play":
        draw_helicopter(x, y)
        for wallb in bottom_walls:
            draw_wallb(wallb)
        for wallt in top_walls:
            draw_wallt(wallt)
        arcade.set_background_color(arcade.color.LIGHT_BLUE)
        arcade.draw_text(f"Score: {score}", 20, 690, arcade.color.BLACK)
    elif current_screen == "pause":
        draw_helicopter(x, y)
        for wallb in bottom_walls:
            draw_wallb(wallb)
        for wallt in top_walls:
            draw_wallt(wallt)
        arcade.draw_text(f"Score: {score}", 20, 690, arcade.color.BLACK)
        arcade.draw_text("PAUSE",
                         HEIGHT / 2 + 150,
                         WIDTH / 4,
                         arcade.color.BLACK,
                         font_size=60,
                         font_name="garamond")
        arcade.draw_text("Press ESCAPE to Resume",
                         HEIGHT / 2 + 55,
                         WIDTH / 4 - 50,
                         arcade.color.BLACK,
                         font_size=30,
                         font_name="garamond")
        arcade.set_background_color(arcade.color.LIGHT_BLUE)
    elif current_screen == "score":
        arcade.set_background_color(arcade.color.LIGHT_BLUE)
        arcade.draw_text(f"Score: {score}",
                         HEIGHT / 2 - 100,
                         WIDTH / 4,
                         arcade.color.BLACK,
                         font_size=60,
                         font_name="garamond")
        arcade.draw_text("To return to menu, press ESC",
                         HEIGHT / 10,
                         WIDTH / 2 - 20,
                         arcade.color.BLACK,
                         font_size=20,
                         font_name="garamond")
        arcade.draw_text("To replay, press SPACE",
                         HEIGHT / 10,
                         WIDTH / 2 - 60,
                         arcade.color.BLACK,
                         font_size=20,
                         font_name="garamond")

    elif current_screen == "play2":
        draw_helicopter2(x, y)
        for wallb in bottom_walls2:
            draw_wall2b()
        for wallt in top_walls2:
            draw_wall2t()
        arcade.draw_text(f"Score: {score}", 20, 690, arcade.color.WHITE)
        arcade.set_background_color(arcade.color.BLACK)
    elif current_screen == "pause2":
        draw_helicopter2(x, y)
        for wallb in bottom_walls2:
            draw_wallb(wallb)
        for wallt in top_walls2:
            draw_wallt(wallt)
        arcade.draw_text(f"Score: {score}", 20, 690, arcade.color.WHITE)
        arcade.draw_text("PAUSE",
                         HEIGHT / 2 + 150,
                         WIDTH / 4,
                         arcade.color.WHITE,
                         font_size=60,
                         font_name="garamond")
        arcade.draw_text("Press ESCAPE to Resume",
                         HEIGHT / 2 + 55,
                         WIDTH / 4 - 50,
                         arcade.color.WHITE,
                         font_size=30,
                         font_name="garamond")
        arcade.set_background_color(arcade.color.BLACK)
    elif current_screen == "score2":
        arcade.set_background_color(arcade.color.BLACK)
        arcade.draw_text(f"Score: {score}",
                         HEIGHT / 2 - 100,
                         WIDTH / 4,
                         arcade.color.WHITE,
                         font_size=60,
                         font_name="garamond")
        arcade.draw_text("To return to menu, press ESC",
                         HEIGHT / 10,
                         WIDTH / 2 - 20,
                         arcade.color.WHITE,
                         font_size=20,
                         font_name="garamond")
        arcade.draw_text("To replay, press ENTER",
                         HEIGHT / 10,
                         WIDTH / 2 - 60,
                         arcade.color.WHITE,
                         font_size=20,
                         font_name="garamond")

    elif current_screen == "Instruction":
        arcade.set_background_color(arcade.color.LIGHT_BLUE)
        arcade.draw_text(
            "Welcome to Hoppy Helecopter! To move your helicopter use W for up and S for down.",
            HEIGHT / 2, WIDTH / 2 - 40, arcade.color.BLACK)
        arcade.draw_text(
            "You can use the esc key to leave the game at any time",
            HEIGHT / 2, WIDTH / 2 - 60, arcade.color.BLACK)
        arcade.draw_text("Press ESC for main menu", HEIGHT / 10,
                         WIDTH / 2 - 40, arcade.color.BLACK)
        arcade.draw_text("KEYBOARD DIAGRAM:", HEIGHT / 10, WIDTH / 2 - 120,
                         arcade.color.BLACK)
        arcade.draw_xywh_rectangle_outline(450, 480, 100, 100,
                                           arcade.color.BLACK)
        arcade.draw_xywh_rectangle_outline(450, 360, 100, 100,
                                           arcade.color.BLACK)
        arcade.draw_xywh_rectangle_outline(300, 480, 100, 100,
                                           arcade.color.BLACK)
        arcade.draw_xywh_rectangle_outline(600, 360, 400, 100,
                                           arcade.color.BLACK)
        arcade.draw_text("SPACE", HEIGHT + 50, WIDTH / 2 - 280,
                         arcade.color.BLACK)
        arcade.draw_text("S", HEIGHT - 220, WIDTH / 2 - 280,
                         arcade.color.BLACK)
        arcade.draw_text("W", HEIGHT - 220, WIDTH / 2 - 160,
                         arcade.color.BLACK)
        arcade.draw_text("ESC", HEIGHT / 2.14, WIDTH / 2 - 160,
                         arcade.color.BLACK)
        arcade.draw_text("ESC = Escape To Menu", HEIGHT / 10, WIDTH / 3,
                         arcade.color.BLACK)
        arcade.draw_text("W = Up:", HEIGHT / 10, WIDTH / 3 - 30,
                         arcade.color.BLACK)
        arcade.draw_text("S = DOWN:", HEIGHT / 10, WIDTH / 3 - 60,
                         arcade.color.BLACK)
        arcade.draw_text("SPACE = START:", HEIGHT / 10, WIDTH / 3 - 90,
                         arcade.color.BLACK)
예제 #28
0
def draw_helicopter2(x, y):
    arcade.draw_xywh_rectangle_filled(x + 200, y + 380, 100, -70,
                                      arcade.color.WHITE)
    arcade.draw_xywh_rectangle_filled(x + 250, y + 380, 50, -35,
                                      arcade.color.BLACK)
    arcade.draw_xywh_rectangle_outline(x + 250, y + 380, 50, -35,
                                       arcade.color.WHITE)
    arcade.draw_xywh_rectangle_filled(x + 200, y + 365, -100, -25,
                                      arcade.color.WHITE)
    arcade.draw_triangle_filled(x + 200, y + 380, x + 235, y + 380, x + 200,
                                y + 400, arcade.color.WHITE)
    arcade.draw_circle_filled(x + 200, y + 400, 10, arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(x + 205, y + 405, 120, -10,
                                       arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(x + 195, y + 405, -120, -10,
                                       arcade.color.WHITE)
    arcade.draw_triangle_filled(x + 100, y + 365, x + 110, y + 365, x + 100,
                                y + 375, arcade.color.WHITE)
    arcade.draw_circle_filled(x + 100, y + 375, 5, arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(x + 102.5, y + 377.5, 25, -5,
                                       arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(x + 97.5, y + 377.5, -25, -5,
                                       arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(x + 225, y + 310, 5, -10,
                                       arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(x + 275, y + 310, -5, -10,
                                       arcade.color.WHITE)
    arcade.draw_xywh_rectangle_outline(x + 200, y + 300, 100, -5,
                                       arcade.color.WHITE)
def draw_character(x, y):
    # This function will draw the main character, x and y are starting coordinates
    # Open window
    arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Main Character")

    # Set the background color
    arcade.set_background_color(arcade.csscolor.WHITE)

    # Get ready to draw
    arcade.start_render()

    # Draw Head
    # Hair
    arcade.draw_xywh_rectangle_filled(x + 4, y - 10, 40, 10,
                                      arcade.csscolor.BLACK)
    # Head itself
    arcade.draw_xywh_rectangle_filled(x + 4, y - 37, 40, 27,
                                      arcade.csscolor.SADDLE_BROWN)
    # Mouth
    arcade.draw_xywh_rectangle_filled(x + 30, y - 31, 14, 3,
                                      arcade.csscolor.BLACK)
    # Eyes
    arcade.draw_xywh_rectangle_filled(x + 36, y - 18, 8, 5,
                                      arcade.csscolor.BLACK)

    # Draw Neck
    arcade.draw_xywh_rectangle_filled(x + 19, y - 44, 11, 7,
                                      arcade.csscolor.SADDLE_BROWN)

    # Draw Body
    arcade.draw_xywh_rectangle_filled(x + 13, y - 79, 21, 35,
                                      arcade.csscolor.INDIANRED)
    arcade.draw_xywh_rectangle_outline(x + 13, y - 79, 21, 35,
                                       arcade.csscolor.DARK_GREY, 1)

    # Draw Arms
    # Right Arm
    arcade.draw_xywh_rectangle_filled(x + 22, y - 65, 7, 14,
                                      arcade.csscolor.INDIANRED)
    arcade.draw_xywh_rectangle_outline(x + 22, y - 65, 7, 14,
                                       arcade.csscolor.DARK_GREY, 1)
    # Left Arm
    arcade.draw_xywh_rectangle_filled(x + 34, y - 57, 14, 6,
                                      arcade.csscolor.INDIANRED)
    arcade.draw_xywh_rectangle_outline(x + 34, y - 57, 14, 6,
                                       arcade.csscolor.DARK_GREY, 1)
    # Right Hand
    arcade.draw_xywh_rectangle_filled(x + 22, y - 72, 7, 7,
                                      arcade.csscolor.BROWN)
    arcade.draw_xywh_rectangle_outline(x + 22, y - 72, 7, 7,
                                       arcade.csscolor.DARK_GREY, 1)
    # Left Hand
    arcade.draw_xywh_rectangle_filled(x + 48, y - 57, 4, 6,
                                      arcade.csscolor.BROWN)
    arcade.draw_xywh_rectangle_outline(x + 48, y - 57, 4, 6,
                                       arcade.csscolor.DARK_GREY, 1)

    # Draw Gun
    arcade.draw_polygon_filled(
        ((x + 52, y - 40), (x + 83, y - 40), (x + 83, y - 46),
         (x + 60, y - 46), (x + 60, y - 57), (x + 52, y - 57)),
        arcade.csscolor.GREY)
    arcade.draw_polygon_outline(
        ((x + 52, y - 40), (x + 83, y - 40), (x + 83, y - 46),
         (x + 60, y - 46), (x + 60, y - 57), (x + 52, y - 57)),
        arcade.csscolor.DARK_GREY, 1)

    # Draw Legs
    # Left Leg
    arcade.draw_xywh_rectangle_filled(x + 13, y - 115, 8, 36,
                                      arcade.csscolor.GRAY)
    # Left Shoe
    arcade.draw_polygon_filled(
        ((x + 13, y - 115), (x + 21, y - 115), (x + 25, y - 118),
         (x + 25, y - 123), (x + 12, y - 123)), arcade.csscolor.GREY)
    # Right Leg
    arcade.draw_xywh_rectangle_filled(x + 26, y - 115, 8, 36,
                                      arcade.csscolor.GRAY)
    # Right Shoe
    arcade.draw_polygon_filled(
        ((x + 26, y - 115), (x + 34, y - 115), (x + 38, y - 118),
         (x + 39, y - 123), (x + 26, y - 123)), arcade.csscolor.GREY)

    # Between Legs
    arcade.draw_xywh_rectangle_filled(x + 21, y - 88, 5, 9,
                                      arcade.csscolor.GRAY)

    # Draw Floor
    arcade.draw_xywh_rectangle_filled(0, 0, SCREEN_WIDTH, 47,
                                      arcade.csscolor.GREEN)

    # Finish drawing
    arcade.finish_render()

    # Keep the window up until someone closes it.
    arcade.run()
예제 #30
0
def on_draw(game: "arcade.Window") -> None:
    """Drawing information on screen"""
    arcade.start_render()
    arcade.draw_text("Pokemon",
                     width / 2,
                     height - 20,
                     arcade.color.BLACK,
                     40,
                     align="center",
                     anchor_x="center",
                     anchor_y="center")
    arcade.draw_text("K to leave", 440, 60, arcade.color.BLACK, 20)

    for i in range(len(game.player_sprite.pokemon)):
        game.player_sprite.pokemon[i].center_x = (125 + i % 2 * 175)
        game.player_sprite.pokemon[i].center_y = (445 - i // 2 * 175)
        game.player_sprite.pokemon[i].draw()

    for i in range(6):
        arcade.draw_xywh_rectangle_outline(50 + i % 2 * 175,
                                           370 - i // 2 * 175, 150, 150,
                                           arcade.color.BLACK, 2)

    # Displaying pokemon stats
    if game.selected is not None:
        arcade.draw_text(game.selected.name, 440, 480, arcade.color.BLACK, 20)
        arcade.draw_text(f"# {game.selected.num}", 440, 460,
                         arcade.color.BLACK, 20)
        arcade.draw_text(f"lvl: {game.selected.lvl}", 440, 440,
                         arcade.color.BLACK, 20)
        arcade.draw_text(
            f"hp: {game.selected.cur_stats[0]} / {game.selected.stats[0]}",
            440, 420, arcade.color.BLACK, 20)
        arcade.draw_text(f"atk: {game.selected.stats[1]}", 440, 400,
                         arcade.color.BLACK, 20)
        arcade.draw_text(f"def: {game.selected.stats[2]}", 440, 380,
                         arcade.color.BLACK, 20)
        arcade.draw_text(f"spd: {game.selected.stats[3]}", 440, 360,
                         arcade.color.BLACK, 20)

        arcade.draw_xywh_rectangle_outline(440, 270, 200, 50,
                                           arcade.color.BLACK, 3)
        arcade.draw_text("switch",
                         540,
                         295,
                         arcade.color.BLACK,
                         25,
                         align="center",
                         anchor_x="center",
                         anchor_y="center")
        arcade.draw_xywh_rectangle_outline(440, 200, 200, 50,
                                           arcade.color.BLACK, 3)
        arcade.draw_text("send to storage",
                         540,
                         225,
                         arcade.color.BLACK,
                         24,
                         align="center",
                         anchor_x="center",
                         anchor_y="center")
    else:
        arcade.draw_text("No Pokemon Selected", 440, 480, arcade.color.BLACK,
                         20)

    if game.switch_pos:
        arcade.draw_text("Switching", 440, 510, arcade.color.BLACK, 20)