def draw(self):
     """Display this button on the screen."""
     # Button's body:
     if self.texture is None:
         arcade.draw_lrtb_rectangle_filled(self.left, self.right, self.top,
                                           self.bottom, self.current_color)
         if self.border_width > 0:
             arcade.draw_lrtb_rectangle_outline(
                 self.left - 1, self.right + 1, self.top + 1,
                 self.bottom - 1, self.border_color, self.border_width)
     else:
         arcade.draw_texture_rectangle(self.center_x,
                                       self.center_y,
                                       self.width,
                                       self.height,
                                       self.texture,
                                       alpha=self.image_alpha)
     # Button's text:
     arcade.draw_text(self.name,
                      self.left + self.font_size,
                      self.bottom + (self.height / 3),
                      self.text_color,
                      self.font_size,
                      align="center",
                      anchor_x="left")
Esempio n. 2
0
    def on_draw(self):
        """Draws the player, walls, current text, and FPS."""

        arcade.start_render()
        # Draw all the sprites
        self.player_list.draw()
        self.wall_list.draw()

        # highlight which block the player is standing on
        arcade.draw_lrtb_rectangle_outline(*map(get_block, [
            self.player_sprite.left, self.player_sprite.left + TILE_W,
            self.player_sprite.bottom, self.player_sprite.bottom - TILE_H
        ]),
                                           color=[255, 00, 00, 100],
                                           border_width=8)

        # grab the pair of blocks that the player is standing on
        byte_x = round(self.p_block_x / 2) * 2
        if byte_x < 2:
            # ensure the pair is above 2 so everything renders properly
            byte_x = 2
        # grab five blocks, starting right behind the player
        hex_block = self.my_map.layers_int_data['Platforms'][
            self.p_block_y][byte_x - 2:byte_x + 10]
        # pair them all up and get their byte-string representations
        paired_blocks = [
            hex_to_byte(tuple(i))
            for i in list(zip(hex_block[::2], hex_block[1::2]))
        ]
        # do some formatting and draw the text on screen
        arcade.draw_text(
            str(b''.join(paired_blocks)).replace('\\x00', ' ')[2:-1],
            self.view_left + TILE_W, self.view_bottom + SCREEN_H - TILE_H,
            arcade.color.WHITE, 24)
Esempio n. 3
0
 def draw_cards(self):
     for card in self.deck.play:
         arcade.draw_lrtb_rectangle_outline(
             card.location[2], card.location[0], card.location[1],
             card.location[3], card.border['color'], card.border['width'])
         loc_x = (card.location[0] + card.location[2]) / 2
         loc_y = (card.location[1] + card.location[3]) / 2
         self.render_card(card, loc_x, loc_y)
Esempio n. 4
0
    def draw(self):
        #HP Bar

        arcade.draw_lrtb_rectangle_outline(546, 754, 574, 506,
                                           arcade.color.BLACK, 5)
        arcade.draw_lrtb_rectangle_filled(550, 750, 570, 510, arcade.color.RED)
        arcade.draw_lrtb_rectangle_filled(550, 750 - self.hpbardecline, 570,
                                          510, arcade.color.GREEN)
Esempio n. 5
0
    def draw(self):
        super().draw()

        if self.selected:
            arcade.draw_lrtb_rectangle_outline(
                self.left,
                self.right,
                self.top,
                self.bottom,
                color=self.HIGHLIGHT_COLOR,
                border_width=self.HIGHLIGHT_WIDTH)
Esempio n. 6
0
    def draw(self):
        # border for class code
        left, width, top, height = self.slides[0][1].kwargs[
            "start_x"], 350, self.slides[0][1].kwargs["start_y"], 200
        left -= 30
        right = left + width
        bottom = top - height
        arcade.draw_lrtb_rectangle_outline(left, right, top, bottom,
                                           arcade.color.BLACK)

        super().draw()
Esempio n. 7
0
    def on_draw(self):
        if self.local_time <= self.fade_in:
            alpha = ease_linear(255, 0, 0, self.fade_in, self.local_time)
            arcade.draw_lrtb_rectangle_filled(0, Settings.width, Settings.height, 0,
                                              (0, 0, 0, alpha))

        if self.window.debug and self.debug_options["box"]:
            arcade.draw_lrtb_rectangle_outline(0, Settings.width, Settings.height, 0, arcade.color.RED, 3)

        self.window.debug_draw()

        for i, (error, _) in enumerate(self._errors):
            error.sprite.draw()
Esempio n. 8
0
    def setup(self):
        """
        Description: Load in resources and set state to pregame screen
        """
        # Display a loading screen
        box_width = 500
        box_height = 60
        font_size = 30
        x = (self.gameOptions['window']['width'] // 2) - (box_width // 2)
        y = (self.gameOptions['window']['height'] / 2) - (box_height // 2)
        arcade.draw_lrtb_rectangle_outline(x, x + box_width, y + box_height, y,
                                           arcade.color.BLUE, 1)
        arcade.draw_text("Loading...",
                         x,
                         y + (box_height // 4),
                         arcade.color.BLACK,
                         font_size,
                         width=box_width,
                         align="center")

        # LOAD GAME SCREENS
        self.pregameScreen = PregameScreen()
        # self.mainMenuScreen = MainMenuScreen()
        # self.loadingScreen = LoadingScreen()
        # self.gameOptionsScreen = GameOptionsScreen()
        # self.characterSelectScreen = CharacterSelectScreen()
        self.twoPlayerScreen = TwoPlayerScreen()
        self.trainingScreen = TrainingScreen()

        # LOAD CHARACTERS
        self.goku = Player("goku")
        self.vegeta = Player("vegeta")
        self.characters.append(self.goku)
        self.characters.append(self.vegeta)

        # LOAD STAGES
        self.field = Field()
        self.guild = Guild()
        self.trainingFacility = TrainingFacility()
        self.stages.append(self.field)
        self.stages.append(self.guild)
        self.stages.append(self.trainingFacility)

        # Set game state to PregameScreen
        self.currentView = self.pregameScreen
Esempio n. 9
0
            def main_boxes():
                #FIELD
                arcade.draw_lrtb_rectangle_outline(
                    left=MARGIN * WINDOW_WIDTH,
                    right=(SCORE_LEFT_BOUNDARY - GAP) * WINDOW_WIDTH,
                    top=(1 - MARGIN) * WINDOW_HEIGHT,
                    bottom=MARGIN * WINDOW_HEIGHT,
                    color=BLACK,
                    border_width=3)

                #SCORE TAB
                arcade.draw_lrtb_rectangle_outline(
                    left=SCORE_LEFT_BOUNDARY * WINDOW_WIDTH,
                    right=(1 - MARGIN) * WINDOW_WIDTH,
                    top=(1 - MARGIN) * WINDOW_HEIGHT,
                    bottom=MARGIN * WINDOW_HEIGHT,
                    color=BLACK,
                    border_width=3)
Esempio n. 10
0
    def draw_inventory(self):
        capacity = self.game_engine.player.inventory.capacity
        selected_item = self.game_engine.selected_item

        field_width = SCREEN_WIDTH / (capacity + 1)
        for i in range(capacity):
            y = 40
            x = i * field_width
            if i == selected_item:
                arcade.draw_lrtb_rectangle_outline(x - 1, x + field_width - 5,
                                                   y + 20, y,
                                                   arcade.color.BLACK, 2)
            if self.game_engine.player.inventory.items[i]:
                item_name = self.game_engine.player.inventory.items[i].name
            else:
                item_name = ""
            text = f"{i + 1}: {item_name}"
            arcade.draw_text(text, x, y, colors["status_panel_text"])
Esempio n. 11
0
    def draw_board(self):
        """Draw the underlying board."""
        arcade.draw_lrtb_rectangle_outline(
            0,
            SCREEN_WIDTH - WIDTH_BUFFER,
            SCREEN_HEIGHT,
            0,
            arcade.csscolor.BLACK,
            border_width=10,
        )

        current_player = self.white_player if self.white_turn else self.black_player
        opponent = self.black_player if self.white_turn else self.white_player

        color_white = False
        for row in range(8):
            for col in range(8):
                position = BoardPosition(col, row)

                # Get color based on boolean
                if current_player.selected_piece is not None and (
                        current_player.selected_piece.board_position
                        == position or position
                        in current_player.selected_piece.get_possible_moves(
                            current_player.pieces,
                            opponent.pieces,
                            get_en_passant_position(opponent),
                        )):
                    color = OFFWHITE_COLOR if color_white else OFFBLACK_COLOR
                else:
                    color = WHITE_COLOR if color_white else BLACK_COLOR

                # Draw a filled rectangle
                arcade.draw_lrtb_rectangle_filled(
                    position.left,
                    position.right,
                    position.top,
                    position.bot,
                    color,
                )
                # Switch color based on column
                color_white = not color_white
            # Switch starting color based on row
            color_white = not color_white
Esempio n. 12
0
def draw_bandera(x, y):  #500 335
    """ left_x, bottom_y """
    arcade.draw_ellipse_filled(x, y - 285, x - 440, y - 305,
                               arcade.color.LIGHT_GRAY)
    arcade.draw_ellipse_outline(x, y - 285, x - 440, y - 305,
                                arcade.color.BLACK, 2)
    arcade.draw_lrtb_rectangle_outline(x - 5, x + 5, y + 165, y - 280,
                                       arcade.color.BLACK, 3)
    arcade.draw_lrtb_rectangle_filled(x - 4, x + 4, y + 164, y - 285,
                                      arcade.color.LIGHT_GRAY)

    arcade.draw_lrtb_rectangle_filled(x, x + 240, y + 160, y, arcade.color.RED)
    arcade.draw_lrtb_rectangle_outline(x, x + 240, y + 160, y,
                                       arcade.color.BLACK, 2)
    draw_star(x + 40, y + 110, 25, 10, arcade.color.YELLOW)
    draw_star(x + 75, y + 135, 10, 4, arcade.color.YELLOW, pi / 10)
    draw_star(x + 95, y + 120, 10, 4, arcade.color.YELLOW, -pi / 10)
    draw_star(x + 95, y + 95, 10, 4, arcade.color.YELLOW)
    draw_star(x + 75, y + 80, 10, 4, arcade.color.YELLOW, pi / 10)
Esempio n. 13
0
def draw_board():
    for i in range(8):
        for j in range(8):
            if (i + j) % 2 == 1:
                color = arcade.csscolor.WHITE
            else:
                color = arcade.csscolor.GRAY

            arcade.draw_lrtb_rectangle_filled(coor2pos(i), coor2pos(i + 1),
                                              coor2pos(j + 1), coor2pos(j),
                                              color)

    # outline board so black squares on border don't look shit
    arcade.draw_lrtb_rectangle_outline(
        OFFSET,
        SCREEN_LENGTH - OFFSET,
        SCREEN_LENGTH - OFFSET,
        OFFSET,
        arcade.csscolor.WHITE,
    )
Esempio n. 14
0
def draw_windmill_body():
    # Windmill cement base.
    arcade.draw_lrtb_rectangle_filled(275, 525, 220, 170, arcade.color.GRAY)

    # Bottom half of windmill.
    arcade.draw_lrtb_rectangle_filled(285, 515, 420, 220,
                                      arcade.color.BROWN_NOSE)

    # Draw a border around the bottom half of the windmill.
    arcade.draw_lrtb_rectangle_outline(285, 515, 420, 220,
                                       arcade.color.DARK_BROWN, 5)

    # Draw the Top of the windmmill.
    arcade.draw_triangle_filled(275, 420, 525, 420, 400, 520,
                                arcade.color.BROWN_NOSE)

    # Put an outline around the roof.
    arcade.draw_triangle_outline(275, 420, 525, 420, 400, 520,
                                 arcade.color.DARK_BROWN, 5)

    # Draw a point.
    arcade.draw_point(400, 460, arcade.color.BLACK, 30)
Esempio n. 15
0
    def draw(self):
        if self.currentSlide == 0:
            # border for class code
            class_pos = [
                [
                    self.slides[0][1].kwargs["start_x"], 250,
                    self.slides[0][1].kwargs["start_y"], 200
                ],
                [
                    self.slides[0][2].kwargs["start_x"], 380,
                    self.slides[0][2].kwargs["start_y"], 200
                ],
            ]  # manually created

            for left, width, top, height in class_pos:
                left -= 10
                right = left + width
                bottom = top - height
                arcade.draw_lrtb_rectangle_outline(left, right, top, bottom,
                                                   arcade.color.BLACK)

        super().draw()
Esempio n. 16
0
    def on_draw(self):
        arcade.start_render()

        # output
        arcade.draw_text("Hits: {}".format(self.red_hits),
                         right + 75, (upper - lower) // 2,
                         arcade.color.CADMIUM_RED,
                         font_size=50)

        # borders
        arcade.draw_lrtb_rectangle_outline(left, right, upper, lower,
                                           arcade.color.ANTI_FLASH_WHITE, 2)

        # circles
        arcade.draw_circle_outline(circles[0].position.x,
                                   circles[0].position.y, circles[0].radius,
                                   arcade.color.CADMIUM_RED,
                                   2)  # research object
        for obj in circles[1:]:  # others
            arcade.draw_circle_outline(obj.position.x, obj.position.y,
                                       obj.radius,
                                       arcade.color.ANTI_FLASH_WHITE, 2)
 def draw_shape(self):
     if self.x <= self.x1:
         if self.y <= self.y1:
             arcade.draw_lrtb_rectangle_outline(self.x, self.x1, self.y1,
                                                self.y, self.color)
         elif self.y1 < self.y:
             arcade.draw_lrtb_rectangle_outline(self.x, self.x1, self.y,
                                                self.y1, self.color)
     elif self.x1 < self.x:
         if self.y <= self.y1:
             arcade.draw_lrtb_rectangle_outline(self.x1, self.x, self.y1,
                                                self.y, self.color)
         elif self.y1 < self.y:
             arcade.draw_lrtb_rectangle_outline(self.x1, self.x, self.y,
                                                self.y1, self.color)
Esempio n. 18
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)
Esempio n. 19
0
def welcome_sign():
    # Graphic welcome sign

    arcade.open_window(900, 900, "Casino Welcome Sign")

    arcade.set_background_color(arcade.csscolor.LIGHT_BLUE)
    arcade.start_render()

    arcade.draw_lrtb_rectangle_filled(240, 660, 460, 250,
                                      arcade.csscolor.LIGHT_STEEL_BLUE)
    arcade.draw_lrtb_rectangle_outline(240, 660, 460, 250,
                                       arcade.csscolor.BLACK, 4)

    arcade.draw_text(
        "Welcome to The Casino Game!",
        295,
        410,
        arcade.color.BLACK,
        20,
    )
    arcade.draw_text(
        "You are in debt for $20,000. Your goal",
        255,
        380,
        arcade.color.BLACK,
        20,
    )
    arcade.draw_text(
        " is to make this $20,000 in the casino ",
        255,
        350,
        arcade.color.BLACK,
        20,
    )
    arcade.draw_text(
        " with $1,000. Failure to acquire this ",
        255,
        320,
        arcade.color.BLACK,
        20,
    )
    arcade.draw_text(
        "money will result in debt collectors ",
        255,
        290,
        arcade.color.BLACK,
        20,
    )
    arcade.draw_text(
        " arresting you.",
        255,
        260,
        arcade.color.BLACK,
        20,
    )
    arcade.draw_text(
        "Close this Window to Start Playing",
        330,
        200,
        arcade.color.RED,
        14,
    )

    arcade.draw_lrtb_rectangle_filled(320, 335, 600, 462, arcade.csscolor.GRAY)
    arcade.draw_lrtb_rectangle_filled(560, 575, 600, 462, arcade.csscolor.GRAY)

    arcade.draw_lrtb_rectangle_filled(280, 310, 248, 80, arcade.csscolor.GRAY)
    arcade.draw_lrtb_rectangle_filled(590, 620, 248, 80, arcade.csscolor.GRAY)

    arcade.draw_text(
        "$",
        310,
        370,
        arcade.color.BLACK,
        420,
    )
    arcade.draw_text(
        "$",
        320,
        390,
        arcade.color.FOREST_GREEN,
        400,
    )

    arcade.draw_lrtb_rectangle_filled(350, 360, 680, 670, arcade.csscolor.GRAY)
    arcade.draw_lrtb_rectangle_filled(540, 550, 680, 670, arcade.csscolor.GRAY)

    arcade.draw_lrtb_rectangle_filled(200, 700, 760, 680,
                                      arcade.csscolor.LIGHT_STEEL_BLUE)
    arcade.draw_lrtb_rectangle_outline(200, 700, 760, 680,
                                       arcade.csscolor.BLACK, 4)

    arcade.draw_lrtb_rectangle_filled(300, 600, 670, 600,
                                      arcade.csscolor.LIGHT_STEEL_BLUE)
    arcade.draw_lrtb_rectangle_outline(300, 600, 670, 600,
                                       arcade.csscolor.BLACK, 4)

    arcade.draw_text(
        "Welcome to",
        265,
        680,
        arcade.color.BLACK,
        60,
    )
    arcade.draw_text(
        "The Casino",
        340,
        606,
        arcade.color.BLACK,
        40,
    )

    arcade.draw_ellipse_filled(450, -300, 1900, 800,
                               arcade.csscolor.DARK_GREEN)

    arcade.finish_render()

    arcade.run()
Esempio n. 20
0
                           arcade.csscolor.GRAY)
arcade.draw_polygon_outline(((245, 90), (285, 90), (310, 0), (210, 0)),
                            arcade.csscolor.BLACK, 3)
y = 5
z = 15
for x in range(1, 5):
    arcade.draw_line(245 - (x * y), 90 - (x * z), 285 + ((x * y) - x),
                     90 - (x * z), arcade.csscolor.BLACK, 3)
    y += 1.3
    z += 3

# cabin
arcade.draw_triangle_filled(200, 200, 360, 200, 290, 300,
                            arcade.csscolor.DARK_RED)
arcade.draw_lrtb_rectangle_filled(220, 340, 200, 90, arcade.csscolor.BROWN)
arcade.draw_lrtb_rectangle_outline(220, 340, 200, 90, arcade.csscolor.BLACK, 3)
arcade.draw_triangle_outline(200, 200, 360, 200, 290, 300,
                             arcade.csscolor.BLACK, 3)

# cabin door
arcade.draw_lrtb_rectangle_filled(245, 285, 160, 92,
                                  arcade.csscolor.SADDLE_BROWN)
arcade.draw_lrtb_rectangle_outline(245, 285, 160, 92, arcade.csscolor.BLACK, 2)
arcade.draw_circle_filled(249, 126, 4, arcade.csscolor.GOLDENROD)
arcade.draw_circle_outline(249, 126, 5, arcade.csscolor.BLACK, 2)

# tree
arcade.draw_lrtb_rectangle_filled(85, 110, 190, 90, arcade.color.BOLE)
arcade.draw_lrtb_rectangle_outline(85, 110, 190, 90, arcade.color.BLACK, 2)
arcade.draw_circle_filled(100, 190, 40, arcade.csscolor.DARK_GREEN)
for x in range(0, 180, 25):
Esempio n. 21
0
    def on_draw(self):
        """
        Render the screen.
        """

        # This command should happen before we start drawing. It will clear
        # the screen to the background color, and erase what we drew last frame.
        arcade.start_render()

        # start_x and start_y make the start point for the text. We draw a dot to make it easy too see
        # the text in relation to its start x and y.
        start_x = 50
        start_y = 450
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text("Simple line of text in 12 point", start_x, start_y,
                         arcade.color.BLACK, 12)

        start_x = 50
        start_y = 150
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text("Garamond Text",
                         start_x,
                         start_y,
                         arcade.color.BLACK,
                         15,
                         font_name='GARA')

        start_x = 50
        start_y = 400
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text("Text anchored 'top' and 'left'.",
                         start_x,
                         start_y,
                         arcade.color.BLACK,
                         12,
                         anchor_x="left",
                         anchor_y="top")

        start_y = 350
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text("14 point multi\nline\ntext",
                         start_x,
                         start_y,
                         arcade.color.BLACK,
                         14,
                         anchor_y="top")

        start_y = 450
        start_x = 300
        width = 200
        height = 20
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_lrtb_rectangle_outline(start_x, start_x + width,
                                           start_y + height, start_y,
                                           arcade.color.BLUE, 1)
        arcade.draw_text("Centered Text.",
                         start_x,
                         start_y,
                         arcade.color.BLACK,
                         14,
                         width=200,
                         align="center")

        start_y = 250
        start_x = 300
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text("Text centered on\na point",
                         start_x,
                         start_y,
                         arcade.color.BLACK,
                         14,
                         width=200,
                         align="center",
                         anchor_x="center",
                         anchor_y="center")

        start_y = 150
        start_x = 300
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text("Text rotated on\na point",
                         start_x,
                         start_y,
                         arcade.color.BLACK,
                         14,
                         width=200,
                         align="center",
                         anchor_x="center",
                         anchor_y="center",
                         rotation=self.text_angle)

        start_y = 150
        start_x = 20
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text("Sideways text",
                         start_x,
                         start_y,
                         arcade.color.BLACK,
                         14,
                         width=200,
                         align="center",
                         anchor_x="center",
                         anchor_y="center",
                         rotation=90.0)

        start_y = 20
        start_x = 50
        arcade.draw_point(start_x, start_y, arcade.color.BLUE, 5)
        arcade.draw_text(f"Time elapsed: {self.time_elapsed:7.1f}", start_x,
                         start_y, arcade.color.BLACK, 14)
Esempio n. 22
0
    def on_draw(self):
        """
                Render the screen.
                """

        # This command should happen before we start drawing. It will clear
        # the screen to the background color, and erase what we drew last frame.
        arcade.start_render()
        # Draw the sky in the top two-thirds
        arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT,
                                          SCREEN_HEIGHT * (1 / 3),
                                          arcade.color.SKY_BLUE)
        # Draw the ground in the bottom third
        arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3,
                                          0, arcade.color.DARK_SPRING_GREEN)

        #Draw score
        output = f"Score: {self.score}"
        arcade.draw_text(output, 10, 20, arcade.color.WHITE, 14)

        # Draw magic bar
        for magic in self.magic_list:
            arcade.draw_circle_filled(magic.x, magic.y, magic.height,
                                      arcade.color.LAVENDER_BLUE, 128)
            arcade.draw_arc_filled(magic.x, magic.y, magic.width, magic.height,
                                   magic.color, magic.s_angle,
                                   (360 * self.magic_resource_percentage),
                                   magic.tilt, magic.sections)
            arcade.draw_circle_outline(magic.x, magic.y, magic.height,
                                       arcade.color.REGALIA, 5, 128)

        if self.kill_timer > 1:
            arcade.draw_text("YOU HAVE FAILED", SCREEN_WIDTH / 2,
                             SCREEN_HEIGHT / 2, arcade.color.CRIMSON_GLORY, 40)

        # Call draw() on all your sprite lists below

        self.spell_list.draw()
        self.spell_firefury_list.draw()
        self.spell_waterblast_list.draw()
        self.spell_lightning_list.draw()
        self.base_list.draw()
        self.enem_list.draw()
        self.enem_shambler_list.draw()

        # draw health bar

        for health in self.health_list:
            arcade.draw_lrtb_rectangle_filled(1200, 1200 + self.health_value,
                                              700 + health.width, 700,
                                              arcade.color.CAMEO_PINK)
            arcade.draw_lrtb_rectangle_outline(1200, (1200 + health.max),
                                               700 + health.width, 700,
                                               arcade.color.CANARY_YELLOW, 5)

        # Draw main menu
        if self.main_menu_open:
            self.menus[0].menu_background.draw()
            self.menus[0].menu_list1.draw()
            # self.menus[0].gui_list.draw()

        elif self.difficulty_menu_open:
            self.menus[0].menu_background.draw()
            self.menus[0].menu_list2.draw()

        self.gui_list.draw()
    def on_draw(self):

        # start timing how long this takes
        draw_start_time = timeit.default_timer()

        if self.frame_count % 60 == 0:
            if self.fps_start_timer is not None:
                total_time = timeit.default_timer() - self.fps_start_timer
                self.fps = 60 / total_time
            self.fps_start_timer = timeit.default_timer()
        self.frame_count += 1

        arcade.start_render()
        '''for i, pair in enumerate([
            ['shear(0.0, 0.1)', Matrix3x3().shear(0.0, 0.1)]
        ]):
            x = 80 + 180 * (i % 4)
            y = 420 - (i // 4) * 320
            arcade.draw_text(pair[0], x, y - 20 - pair[0].count('\n') * 10, arcade.color.WHITE, 10)'''
        # self.xy_sqare.draw_transformed(x, y, 100, 100, 0, 250, pair[1])
        '''for color_index in range(len(self.point_list)):
            self.shape_list.append(
                arcade.create_rectangles_filled_with_colors(
                    self.point_list[color_index],
                    self.color_list[color_index]
                )
            )'''

        # draw all shapes in the list
        self.shape_list.draw()

        # draw the target_fps text
        arcade.draw_text(f"Target FPS:\n- <==Q {self.target_fps} E==> +",
                         int(SCREEN_WIDTH * 0.1), int(SCREEN_HEIGHT * 0.1),
                         TEXT_COLOR)

        # draw the FPS indicator text
        '''arcade.draw_text(f'FPS: {1.0 / self.frameTime}',
                         int(SCREEN_WIDTH * 0.1), int(SCREEN_HEIGHT * 0.9),
                         TEXT_COLOR)'''

        # draw minimap background
        arcade.draw_lrtb_rectangle_filled(0 * MAP_SCALE, 24 * MAP_SCALE,
                                          24 * MAP_SCALE, 0 * MAP_SCALE,
                                          arcade.color.BLACK)

        # draw minimap outer walls
        arcade.draw_lrtb_rectangle_outline(0 * MAP_SCALE, 24 * MAP_SCALE,
                                           24 * MAP_SCALE, 0 * MAP_SCALE,
                                           arcade.color.RED, MAP_SCALE)

        # draw the player location indicator
        arcade.draw_point((self.posX) * MAP_SCALE,
                          (24 - self.posY) * MAP_SCALE, arcade.color.ORANGE,
                          MAP_SCALE)

        # arcade.draw_line(8*MAP_SCALE,1*MAP_SCALE,1*MAP_SCALE,1*MAP_SCALE,arcade.color.WHITE,MAP_SCALE)
        # arcade.draw_line(1*MAP_SCALE,1*MAP_SCALE,1*MAP_SCALE,7*MAP_SCALE,arcade.color.WHITE,MAP_SCALE)
        '''arcade.draw_line_strip(
            [[8 * MAP_SCALE, 1 * MAP_SCALE],
             [1 * MAP_SCALE, 1 * MAP_SCALE],
             [1 * MAP_SCALE, 7 * MAP_SCALE],
             [3 * MAP_SCALE, 7 * MAP_SCALE],
             [3 * MAP_SCALE, 6 * MAP_SCALE],
             [3 * MAP_SCALE, 7 * MAP_SCALE],
             [8 * MAP_SCALE, 7 * MAP_SCALE],
             [8 * MAP_SCALE, 3 * MAP_SCALE],
             [3 * MAP_SCALE, 3 * MAP_SCALE],
             [3 * MAP_SCALE, 4 * MAP_SCALE]],
            arcade.color.WHITE, MAP_SCALE)
        arcade.draw_line_strip(
            [[6 * MAP_SCALE, 20 * MAP_SCALE],
             [11 * MAP_SCALE, 20 * MAP_SCALE],
             [11 * MAP_SCALE, 15 * MAP_SCALE],
             [6 * MAP_SCALE, 15 * MAP_SCALE],
             [6 * MAP_SCALE, 20 * MAP_SCALE]],
            arcade.color.GREEN,
            MAP_SCALE
        )
        arcade.draw_points(
            [[16 * MAP_SCALE, 20 * MAP_SCALE],
             [18 * MAP_SCALE, 20 * MAP_SCALE],
             [20 * MAP_SCALE, 20 * MAP_SCALE],
             [20 * MAP_SCALE, 18 * MAP_SCALE],
             [20 * MAP_SCALE, 16 * MAP_SCALE],
             [18 * MAP_SCALE, 16 * MAP_SCALE],
             [16 * MAP_SCALE, 16 * MAP_SCALE],
             [16 * MAP_SCALE, 18 * MAP_SCALE]],
            arcade.color.BLUE,
            MAP_SCALE
        )

        arcade.draw_point(6 * MAP_SCALE, 5 * MAP_SCALE,
                          arcade.color.YELLOW,
                          MAP_SCALE)'''

        # display timings
        output = f'Processing time: {self.processing_time:.3f}'
        arcade.draw_text(output, 20, SCREEN_HEIGHT - 20, arcade.color.BLACK,
                         16)

        output = f'Drawing time: {self.draw_time:.3f}'
        arcade.draw_text(output, 20, SCREEN_HEIGHT - 40, arcade.color.BLACK,
                         16)

        if self.fps is not None:
            output = f'FPS: {self.fps:.0f}'
            arcade.draw_text(output, 20, SCREEN_HEIGHT - 60,
                             arcade.color.BLACK, 16)

        self.draw_time = timeit.default_timer() - draw_start_time
Esempio n. 24
0
 def draw(self):
     arcade.draw_lrtb_rectangle_outline(left=self.vertex_loop[0].x,
                                        right=self.vertex_loop[1].x,
                                        bottom=self.vertex_loop[0].y,
                                        top=self.vertex_loop[2].y,
                                        color=arcade.color.RED)
    def on_draw(self):
        """
                Render the screen.
                """

        # This command should happen before we start drawing. It will clear
        # the screen to the background color, and erase what we drew last frame.
        arcade.start_render()
        # Draw the sky in the top two-thirds
        arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT,
                                          SCREEN_HEIGHT * (1 / 3),
                                          arcade.color.SKY_BLUE)
        # Draw the ground in the bottom third
        arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3,
                                          0, arcade.color.DARK_SPRING_GREEN)

        # Draw magic bar

        if self.kill_timer > 1:
            arcade.draw_text("YOU HAVE FAILED", SCREEN_WIDTH / 2,
                             SCREEN_HEIGHT / 2, arcade.color.CRIMSON_GLORY, 40)

        # Call draw() on all your sprite lists below

        self.base_list.draw()
        self.enem_list.draw()
        self.enem_shambler_list.draw()
        self.player_list.draw()
        self.spell_list.draw()
        self.spell_firefury_list.draw()
        self.spell_waterblast_list.draw()
        self.spell_lightning_list.draw()

        # draw health bar the reason there is a plus value after the width draw position is if you want to change the
        # thickness of the bars, use the added value to modify
        for health in self.health_list:
            arcade.draw_lrtb_rectangle_filled(1100, 1100 + self.health_value,
                                              750 + 20, 750,
                                              arcade.color.CAMEO_PINK)
            arcade.draw_lrtb_rectangle_outline(1100, (1100 + health.max),
                                               750 + 20, 750,
                                               arcade.color.CANARY_YELLOW, 5)

        for magic in self.magic_list:
            # arcade.draw_circle_filled(magic.x, magic.y, magic.height , arcade.color.LAVENDER_BLUE,
            # 128) arcade.draw_arc_filled(magic.x, magic.y, magic.width,  magic.height, magic.color, magic.s_angle,
            # (360* self.magic_resource_percentage), magic.tilt, magic.sections) arcade.draw_circle_outline(magic.x,
            # magic.y, magic.height , arcade.color.REGALIA, 5, 128)
            arcade.draw_lrtb_rectangle_filled(1100, 1100 + magic.max, 700 + 20,
                                              700, arcade.color.REGALIA)
            arcade.draw_lrtb_rectangle_filled(
                1100, 1100 + (magic.max * self.magic_resource_percentage),
                700 + 20, 700, arcade.color.LAVENDER_BLUE)
            arcade.draw_lrtb_rectangle_outline(1100, (1100 + magic.max),
                                               700 + 20, 700,
                                               arcade.color.REGALIA, 5)

        # Draw main menu
        if self.main_menu_open:
            self.menus[0].menu_background.draw()
            self.menus[0].menu_list1.draw()

        if self.difficulty_menu_open:
            self.menus[0].menu_background.draw()
            self.menus[0].menu_list2.draw()

        if self.upgrade_menu_open:
            self.upgrade_menus[0].background_list.draw()
            self.upgrade_menus[0].menu_list.draw()

            if self.fire1_purchased:
                self.upgrade_menus[0].active_fire1.draw()
            if self.fire2_purchased:
                self.upgrade_menus[0].active_fire2.draw()
            if self.lightning1_purchased:
                self.upgrade_menus[0].active_lightning1.draw()
            if self.lightning2_purchased:
                self.upgrade_menus[0].active_lightning2.draw()
            if self.plasma1_purchased:
                self.upgrade_menus[0].active_plasma1.draw()
            if self.plasma2_purchased:
                self.upgrade_menus[0].active_plasma2.draw()
            if self.water1_purchased:
                self.upgrade_menus[0].active_water1.draw()
            if self.water2_purchased:
                self.upgrade_menus[0].active_water2.draw()

            if self.wall_level > 0:
                self.upgrade_menus[0].active_wall1.draw()
            if self.wall_level == 2:
                self.upgrade_menus[0].active_wall2.draw()

            if self.wall1_details_open:
                self.upgrade_menus[0].wall1_details.draw()
            if self.wall2_details_open:
                self.upgrade_menus[0].wall2_details.draw()
            if self.fire1_details_open:
                self.upgrade_menus[0].fire1_details.draw()
            if self.fire2_details_open:
                self.upgrade_menus[0].fire2_details.draw()
            if self.lightning1_details_open:
                self.upgrade_menus[0].lightning1_details.draw()
            if self.lightning2_details_open:
                self.upgrade_menus[0].lightning2_details.draw()
            if self.plasma1_details_open:
                self.upgrade_menus[0].plasma1_details.draw()
            if self.plasma2_details_open:
                self.upgrade_menus[0].plasma2_details.draw()
            if self.water1_details_open:
                self.upgrade_menus[0].water1_details.draw()
            if self.water2_details_open:
                self.upgrade_menus[0].water2_details.draw()

        self.gui_list.draw()
 def DrawButton(self):
     arcade.draw_lrtb_rectangle_filled(self.xLeft, self.xRight, self.yTop,
                                       self.yBottom, self.color)
     arcade.draw_lrtb_rectangle_outline(self.xLeft, self.xRight, self.yTop,
                                        self.yBottom, self.edgeColor, 2)
Esempio n. 27
0
#arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE)
#arcade.set_background_color((114, 160, 199))   #=AIR_SUPERIORITY_BLUE
#arcade.set_background_color((127, 127, 127))    #GRAY
arcade.set_background_color((0, 225, 225))  #LIGHT BLUE

arcade.start_render()  #I'm about to draw from now on. ready for that!

arcade.draw_lrtb_rectangle_filled(
    5,
    35,
    590,
    570,  #left/right/tob/bottom
    arcade.color.BITTER_LIME  #color
)

arcade.draw_lrtb_rectangle_outline(5, 35, 90, 70, arcade.color.BITTER_LIME)

arcade.draw_lrtb_rectangle_outline(100, 35, 90, 70, arcade.color.BITTER_LIME,
                                   45)

arcade.draw_point(50, 580, arcade.color.RED, 5)

arcade.draw_line()

arcade.draw_circle_filled(190, 580, 18, arcade.color.RED)

arcade.finish_render(
)  #I'm doen my drawing. You don't need to get ready for drawing anymore.

arcade.start_render()
Esempio n. 28
0
def draw_support_outline(x1, x2, y1, y2):
    arcade.draw_lrtb_rectangle_outline(x1, x2, y1, y2, arcade.color.BLACK, 2)
Esempio n. 29
0
 def draw(self):
     arcade.draw_lrtb_rectangle_outline(self.lft, self.rt, self.tp,
                                        self.btm, self.clr, self.otln)
Esempio n. 30
0
import arcade

arcade.open_window("SpaceX Dragon", 600, 600)

# Set background color to space black and create the trunk.

arcade.start_render()
arcade.draw_lrtb_rectangle_filled(190, 400, 400, 250, (203, 214, 214))
arcade.draw_lrtb_rectangle_outline(190, 400, 400, 250, (121, 123, 128), 5)

# little squares 1
arcade.draw_lrtb_rectangle_filled(180, 190, 300, 290, (121, 123, 128))
arcade.draw_lrtb_rectangle_filled(400, 410, 300, 290, (121, 123, 128))

# First lateral Panels(left,right)
arcade.draw_lrtb_rectangle_filled(140, 180, 370, 250, (65, 88, 140))
arcade.draw_lrtb_rectangle_filled(410, 450, 370, 250, (65, 88, 140))
point_list = ((160, 280), (160, 340), (430, 280), (430, 340))
arcade.draw_points(point_list, (0, 0, 0), 10)
# little squares 2
arcade.draw_lrtb_rectangle_filled(130, 140, 300, 290, (121, 123, 128))
arcade.draw_lrtb_rectangle_filled(450, 460, 300, 290, (121, 123, 128))

# Second lateral panels
arcade.draw_lrtb_rectangle_filled(90, 130, 370, 250, (65, 88, 140))
arcade.draw_lrtb_rectangle_filled(460, 500, 370, 250, (65, 88, 140))
point_list = ((100, 280), (100, 340), (120, 280), (120, 340), (470, 280),
              (470, 340), (490, 280), (490, 340))
arcade.draw_points(point_list, (0, 0, 0), 10)
# little squares 3
point_list = ((85, 295), (505, 295))