def on_draw(self): """ Draw everything """ arcade.start_render() self.offscreen.use() self.offscreen.clear(arcade.color.AMAZON) arcade.draw_rectangle_outline(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT, arcade.color.WHITE, 10) self.coin_list.draw() self.player_list.draw() self.use() arcade.draw_rectangle_filled(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT, arcade.color.AMAZON) self.color_attachment.use(0) self.quad_fs.render(self.program) arcade.draw_rectangle_filled(SCREEN_WIDTH - SCREEN_WIDTH / 8, SCREEN_HEIGHT - SCREEN_HEIGHT / 8, SCREEN_WIDTH / 4, SCREEN_HEIGHT / 4, arcade.color.BLACK) self.color_attachment.use(0) self.mini_map_quad.render(self.program) # Put the text on the screen. output = f"Score: {self.score}" arcade.draw_text(output, 10, 20, arcade.color.WHITE, 14)
def drawBoard(board, x, y): # xSpace = (SCREEN_WIDTH - SQUARE_SIZE * len(board))/2 + SQUARE_SIZE/2 # ySpace = (SCREEN_HEIGHT - SQUARE_SIZE * len(board[0]))/2 + SQUARE_SIZE/2 red = 0 green = 8 blue = 25 for i in range(len(board)): for j in range(len(board[0])): if board[i][j] == -1: arcade.draw_rectangle_filled(x + i * SQUARE_SIZE, y + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, FOOD_COLOR) elif board[i][j] == 0: arcade.draw_rectangle_filled(x + i * SQUARE_SIZE, y + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, (255, 0, 0)) else: arcade.draw_rectangle_filled( x + i * SQUARE_SIZE, y + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, (red + int(1.5 * (board[i][j] + 1)), blue + 4 * (board[i][j] + 1), green + 0 * (board[i][j] + 1))) arcade.draw_rectangle_outline(x + i * SQUARE_SIZE, y + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, (255, 0, 0))
def on_draw(): # arcade.draw_rectangle_outline(x coord,y coord, width, height, arcade.color.color, thick arcade.start_render() # Draw in here... arcade.draw_rectangle_outline( 450, 710, 400, 100, arcade.color.BLACK, ) arcade.draw_text("Smart Phone Addiction!", start_x, start_y, arcade.color.BLACK, 20) arcade.draw_text("Nomophobia—an abbreviation of “no-mobile-phone-phobia.", 67, 550, arcade.color.BLACK, 13) arcade.draw_text( "Cell phones used to just be communication tools. Now, they’re GPS, cameras, and the list goes on. ", 67, 500, arcade.color.BLACK, 13) arcade.draw_text( "Mobile phone overuse is a proposed form of psychological or behavioural dependence on cell phones, closely related to", 67, 450, arcade.color.BLACK, 12) arcade.draw_text( "other forms of digital media overuse such as social media addiction or internet addiction disorder.", 67, 400, arcade.color.BLACK, 12) texture = arcade.load_texture("0_J7vwt-FyYYhVRPxM.jpg") scale = .5 arcade.draw_texture_rectangle(500, 170, scale * texture.width, scale * texture.height, texture, 0)
def on_draw(self): """ Render the screen. """ # This command has to happen before we start drawing arcade.start_render() if self.current_state == "GAME_RUNNING": arcade.draw_texture_rectangle(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) # Draw all the sprites. self.animal_sprite_list.draw() self.bullet_list.draw() self.player_list.draw() # Put the text on the screen. bullet_output = f"Bullets Used: {self.bullets_used}" food_output = f"Food Gathered: {self.pounds_of_meat} pounds" arcade.draw_text(bullet_output, 10, 20, arcade.color.WHITE, 14) arcade.draw_text(food_output, 150, 20, arcade.color.WHITE, 14) self.test_image_move += 1 else: bullet_output = f"Bullets Used: {self.bullets_used}" food_output = f"Food Gathered: {self.pounds_of_meat} pounds" arcade.draw_text("Round Over", 500, 530, arcade.color.BLACK, 60) arcade.draw_text(bullet_output, 550, 450, arcade.color.WHITE, 24) arcade.draw_text(food_output, 550, 375, arcade.color.WHITE, 24) arcade.draw_text("Click to hunt again...", 500, 300, arcade.color.BLACK, 24) arcade.draw_rectangle_outline(SCREEN_WIDTH // 2, 460, 475, 400, arcade.color.BLACK, 6)
def draw(self): if self.background is not None: arcade.draw_lrwh_rectangle_textured(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, self.background) if self.bucket_list is not None: self.bucket_list.draw() if self.object_list is not None: self.object_list.draw() if self.selected_bucket is not None: arcade.draw_rectangle_outline( self.bucket_list[self.selected_bucket].center_x, self.bucket_list[self.selected_bucket].center_y, self.bucket_list[self.selected_bucket].height * 1.2, self.bucket_list[self.selected_bucket].width * 1.2, self.bucket_list[self.selected_bucket].color, (self.tick % 12) + 2, 0) arcade.draw_text( "Time Left {:d}".format(int( (self.length - self.tick) / 60)), (SCREEN_WIDTH / 6) * 4, SCREEN_HEIGHT - (SCREEN_HEIGHT / 10), arcade.color.BLACK, 60) arcade.draw_text("Score: {}".format(self.score), 0, (SCREEN_HEIGHT / 10) * 9, arcade.color.RED, 64) if self.tick > self.length: arcade.draw_text("GAME OVER", (SCREEN_WIDTH / 5) * 1, (SCREEN_HEIGHT / 6) * 3, arcade.color.BLACK, 128)
def draw(self, x, y): if self.center_x - self.w/2 < x < self.center_x + self.w/2 and \ self.center_y - self.h/2 < y < self.center_y + self.h/2: color = self.active_c text_color = self.text_color_2 # window.set_mouse_cursor(window.cursor_hand) else: color = self.inactive_c text_color = self.text_color # window.set_mouse_cursor(window.cursor_arrow) arcade.draw_rectangle_filled(self.center_x, self.center_y, self.w, self.h, color) arcade.draw_text(self.text, self.center_x, self.center_y, text_color, 14, align="center", anchor_x="center", anchor_y="center") arcade.draw_rectangle_outline(self.center_x, self.center_y, self.w, self.h, self.inactive_c, 10)
def draw_board(): global animated_cir_rad # Draw Grid # vertical lines for x in range(9): arcade.draw_line(x * 100, 0, x * 100, 100 * 8, arcade.color.BLACK, 4) # horizontal lines for x in range(9): arcade.draw_line(0, x * 100, 100 * 8, x * 100, arcade.color.BLACK, 4) for y, row in enumerate(board): for x, cellx in enumerate(row): cc = x * 100 + 50, (8 - y) * 100 - 50 # cell center if cellx == 1: arcade.draw_circle_filled(cc[0], cc[1], 30, players[0]['coincolor']) if cellx == 2: arcade.draw_circle_filled(cc[0], cc[1], 30, players[1]['coincolor']) if cellx == 3: arcade.draw_circle_filled(cc[0], cc[1], animated_cir_rad, players[0]['coincolor']) if cellx == 4: arcade.draw_circle_filled(cc[0], cc[1], animated_cir_rad, players[1]['coincolor']) #draw cursor if y == cursor[0] and x == cursor[1]: arcade.draw_rectangle_outline(cc[0], cc[1], 91, 91, player['coincolor'], 5)
def on_draw(self): """ Called when it is time to draw the world """ arcade.start_render() self.status.draw() output = f"Score: {self.points}" arcade.draw_rectangle_outline(35, 55, 60.0, 45.0, arcade.color.BLACK) arcade.draw_text(output, 10, 50, arcade.color.BLACK, 13)
def draw(self): arcade.draw_rectangle_outline(self.center.x, self.center.y, self.prop.width, self.prop.height, self.prop.color, border_width=3)
def draw(self): # Draw outline of arena arcade.draw_rectangle_outline(WINDOWWIDTH / 2, WINDOWHEIGHT / 2, WINDOWWIDTH, WINDOWHEIGHT, WHITE, LINETHICKNESS * 2) # Draw centre line arcade.draw_rectangle_filled(WINDOWWIDTH / 2, WINDOWHEIGHT / 2, LINETHICKNESS / 4, WINDOWHEIGHT, WHITE) arcade.draw_text( str(self.paddle1.score), WINDOWWIDTH / 2 - FONTSIZE, WINDOWHEIGHT - FONTSIZE, WHITE, FONTSIZE, align="center", anchor_x="center", anchor_y="center", ) arcade.draw_text( str(self.paddle2.score), WINDOWWIDTH / 2 + FONTSIZE, WINDOWHEIGHT - FONTSIZE, WHITE, FONTSIZE, align="center", anchor_x="center", anchor_y="center", )
def draw(self, longest=None): arcade.draw_text( self.text, self.x, self.y, color=arcade.csscolor.WHITE, ) arcade.draw_rectangle_outline(self.x + longest + 35, self.y + 8, 49, 20, color=arcade.color.WHITE) if self.value: arcade.draw_rectangle_filled( self.x + longest + 47, self.y + 8, 23, 18, color=arcade.color.BUD_GREEN, ) else: arcade.draw_rectangle_filled( self.x + longest + 23, self.y + 8, 23, 18, color=arcade.color.CG_RED, )
def draw(self): if DEBUG: arcade.draw_rectangle_filled(60, 67.5, 100, 130, arcade.color.BLUSH) arcade.draw_text("speed: " + str(round(self.speed, 3)), 25, 115, arcade.color.BLACK, 10) arcade.draw_text("x: " + str(round(self.center.x, 3)), 25, 100, arcade.color.BLACK, 10) arcade.draw_text("y: " + str(round(self.center.y, 3)), 25, 85, arcade.color.BLACK, 10) arcade.draw_text("h: " + str(round(self.heading, 3)), 25, 70, arcade.color.BLACK, 10) arcade.draw_text("wh: " + str(round(self.wheels_turn, 3)), 25, 55, arcade.color.BLACK, 10) arcade.draw_text( "Mwh: " + str(round(self.getMaxWheelsTurn(), 3)), 25, 40, arcade.color.BLACK, 10) arcade.draw_text("score: " + str(round(self.score, 3)), 25, 25, arcade.color.BLACK, 10) if self.turn_center is not None: self.turn_center.draw(arcade.color.GREEN) if self.turn_radius is not None: arcade.draw_circle_outline(self.turn_center.x, self.turn_center.y, self.turn_radius, arcade.color.GREEN, 2) self.front_wheel.draw(arcade.color.RED) self.center.draw(arcade.color.YELLOW) self.rear_wheel.draw(arcade.color.BLUE) arcade.draw_rectangle_outline(self.center.x, self.center.y, self.width, self.length, arcade.color.YELLOW, 2, self.heading) else: self.sprite.draw()
def draw(self): self.label_location_map.clear() from .app import app center_x = app.window.width // 2 y = super(Menu, self).draw() y += self.label_height // 2 for i, label in enumerate(self.labels): focused = i == self.selected_action_index self.label_location_map[(center_x, y)] = i arcade.draw_rectangle_filled(color=arcade.color.BABY_BLUE if focused else arcade.color.BLUE_GRAY, center_x=center_x, center_y=app.window.height - y, width=self.label_width, height=self.label_height) arcade.draw_rectangle_outline( color=arcade.color.BLUE if focused else arcade.color.BLACK, center_x=center_x, center_y=app.window.height - y, width=self.label_width, height=self.label_height) arcade.render_text(label, start_x=center_x - label.content_width // 2, start_y=app.window.height - y) y += self.label_height + self.label_step_size
def draw_player_info_template(self, hit_points, energy_points, view_bottom, view_left): if self.showUI: # Player Info Background arcade.draw_rectangle_filled(view_left + 125, view_bottom + 675, 250, 100, arcade.color.BLACK) # Player Info Border arcade.draw_rectangle_outline(view_left + 125, view_bottom + 675, 250, 100, arcade.color.WHITE_SMOKE) # Player Image Box arcade.draw_rectangle_filled(view_left + 50, view_bottom + 675, 75, 75, arcade.color.HAN_BLUE) self.profile_rachel.set_position(view_left + 50, view_bottom + 675) self.profile_rachel.draw() # HP Info arcade.draw_text(str(hit_points) + " / 100 HP", view_left + 95, view_bottom + 700, arcade.color.RED, 20, anchor_x="left", anchor_y="top") # EP Info arcade.draw_text(str(energy_points) + " / 100 EP", view_left + 95, view_bottom + 670, arcade.color.GOLD, 20, anchor_x="left", anchor_y="top")
def drawBoard(board): xSpace = (SCREEN_WIDTH - SQUARE_SIZE * len(board)) / 2 + SQUARE_SIZE / 2 ySpace = (SCREEN_HEIGHT - SQUARE_SIZE * len(board[0])) / 2 + SQUARE_SIZE / 2 red = 1 green = 4 blue = 9 for i in range(len(board)): for j in range(len(board[0])): if board[i][j] == -1: arcade.draw_rectangle_filled(xSpace + i * SQUARE_SIZE, ySpace + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, FOOD_COLOR) elif board[i][j] == 0: arcade.draw_rectangle_filled(xSpace + i * SQUARE_SIZE, ySpace + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, (255, 0, 0)) else: arcade.draw_rectangle_filled( xSpace + i * SQUARE_SIZE, ySpace + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, (red * (board[i][j] + 1), blue * (board[i][j] + 1), green * (board[i][j] + 1))) # if i-1 > 0 and board[i-1][j] > 0: # arcade.draw_line(i * 100 + 50, j * 100 + 50, (i-1) * 100 + 50, j * 100 + 50) arcade.draw_rectangle_outline(xSpace + i * SQUARE_SIZE, ySpace + j * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE, (255, 0, 0))
def draw_toolbar_shapes(): # Export button arcade.draw_text("EXPORT", 15, 765, arcade.color.BLACK, font_size=18) # Draw rectangles arcade.draw_rectangle_filled(25, 725, 35, 15, arcade.color.BLUE) arcade.draw_rectangle_outline(75, 725, 35, 15, arcade.color.BLUE) # Draw circles arcade.draw_circle_filled(25, 675, 13, arcade.color.BLUE) arcade.draw_circle_outline(75, 675, 13, arcade.color.BLUE) # Draw ellipses arcade.draw_ellipse_filled(25, 625, 18, 8, arcade.color.BLUE) arcade.draw_ellipse_outline(75, 625, 18, 8, arcade.color.BLUE) # Draw triangles arcade.draw_triangle_filled(25, 590, 10, 560, 40, 560, arcade.color.BLUE) arcade.draw_triangle_outline(75, 590, 60, 560, 90, 560, arcade.color.BLUE) # Draw arc tops (to symbolize arc tops & bottoms) arcade.draw_arc_filled(25, 520, 15, 15, arcade.color.BLUE, 0, 180) arcade.draw_arc_outline(75, 520, 15, 15, arcade.color.BLUE, 0, 180) # Draw lines arcade.draw_line(10, 460, 40, 490, arcade.color.BLUE, line_width=2) arcade.draw_line(60, 460, 90, 490, arcade.color.BLUE, line_width=1)
def win_condition(): """ The win condition must be fulfilled to win :return: """ arcade.draw_rectangle_outline(200, 650, 100, 10, arcade.color.NEON_CARROT)
def draw(self): """ Display this Slider on the screen. """ # Slider name: arcade.draw_text(self.variable_name.title(), self.left, self.top + self.height / 2, WHITE, self.font_size) # Slider rail: arcade.draw_rectangle_filled(self.center_x, self.center_y, self.width, self.height, self.slide_color) arcade.draw_rectangle_outline(self.center_x, self.center_y, self.width + 2, self.height + 2, self.border_color) # Slider handle: arcade.draw_circle_filled(self.slider_position, self.center_y, self.height / 1.5, self.slider_cur_color) arcade.draw_circle_outline(self.slider_position, self.center_y, (self.height / 1.5) + 2, self.border_color) # Variable value: arcade.draw_text(str(self._var_cur_val), self.right, self.top + self.height / 2, GREEN, self.font_size, anchor_x="right")
def on_draw(self): arcade.start_render() arcade.draw_lrwh_rectangle_textured(0, 0, self.width, self.height, self.background) arcade.draw_text( "Flawless", self.width // 2, self.height * 0.90, TEXT_COLOR, 20, anchor_x="center", ) field = self.field_list[self.selection_index] arcade.draw_rectangle_outline( center_x=field.x - 40, center_y=field.y + 8, width=self.width // 8 - 20, height=30, color=TEXT_COLOR, ) for field in self.field_list: field.draw() self.draw_information_text(TEXT_COLOR, nav=True)
def draw_board(self, screen_height) -> None: """Draws the game board :param screen_height: height of screen """ text_adjust = {"x": self.width//8, "y": self.height//3} drawn_vertical = [False]*2 drawn_horizontal = [False]*2 for i in range(len(self.drawing_board)): for j in range(len(self.drawing_board[0])): # figure out box position box_x = (self.margin + self.width) * j + self.margin + self.width//2 box_y = screen_height - ((self.margin + self.height) * i + self.margin + self.height // 2) # check to see if vertical line must be drawn if j % 3 == 0 and j != 8 and j != 0 and not drawn_vertical[j//3 - 1]: arcade.draw_line((self.margin+self.width)*j + self.margin//2, screen_height - self.margin, (self.margin+self.width)*j + self.margin//2, screen_height - (self.margin+self.height)*len(self.drawing_board), arcade.color.BLACK, 4) # draw box arcade.draw_rectangle_outline(box_x, box_y, self.width, self.height, arcade.color.BLACK) # write number if there is one if self.drawing_board[i][j] != 0: arcade.draw_text(str(self.drawing_board[i][j]), box_x - text_adjust["x"], box_y - text_adjust["y"], arcade.color.BLACK, 20) # check to see if horizontal line must be drawn if i % 3 == 0 and i != 8 and i != 0 and not drawn_horizontal[i // 3 - 1]: arcade.draw_line(self.margin, screen_height - ((self.margin+self.height)*i + self.margin//2), (self.margin+self.width)*len(self.drawing_board[i]), screen_height - ((self.margin+self.height)*i + self.margin//2), arcade.color.BLACK, 4)
def on_draw(self): arcade.start_render() # Circle - Kör arcade.draw_circle_filled(240, 360, 30, arcade.color.BLUE) arcade.draw_circle_outline(340, 360, 30, arcade.color.BUFF) # Ellipse - Ellipszis arcade.draw_ellipse_filled(100, 100, 50, 80, arcade.color.AO) arcade.draw_ellipse_outline(200, 100, 50, 80, arcade.color.YELLOW) # Rectangle - Téglalap arcade.draw_rectangle_filled(300, 100, 50, 50, arcade.color.ALIZARIN_CRIMSON) arcade.draw_rectangle_outline(400, 100, 50, 150, arcade.color.YANKEES_BLUE, 4) # Text - Szöveg arcade.draw_text("Kóder Klub", 20, 720 - 80, arcade.color.AQUA, 24) # Arc - Ív arcade.draw_arc_filled(640, 720 - 80, 120, 120, arcade.color.YELLOW_ORANGE, 0, 90) arcade.draw_arc_filled(1040, 720 - 80, 120, 120, arcade.color.YELLOW_ORANGE, 0, 270) # Triangle - Háromszög arcade.draw_polygon_outline([[0, 0], [50, 0], [25, 50]], arcade.color.AFRICAN_VIOLET) # Pentagon - Ötszög arcade.draw_polygon_outline( [[640, 360], [640 + 50, 360], [640 + 75, 360 + 25], [640 + 25, 360 + 50], [640 - 25, 360 + 25]], arcade.color.ALLOY_ORANGE)
def draw_dresser(): # ------Dresser # Mirror texture8 = arcade.load_texture("images/glass.png") scale = .3 arcade.draw_texture_rectangle(499, 395, scale * texture8.width, scale * texture8.height, texture8, 0) # Foundation arcade.draw_rectangle_filled(580, 250, 70, 150, arcade.color.VIVID_VIOLET) arcade.draw_rectangle_filled(420, 250, 70, 150, arcade.color.VIVID_VIOLET) arcade.draw_rectangle_filled(500, 290, 150, 70, arcade.color.VIVID_VIOLET) # Counter arcade.draw_rectangle_filled(500, 290, 200, 30, arcade.color.BLACK) arcade.draw_rectangle_outline(500, 290, 200, 30, arcade.color.CYBER_GRAPE, 3) # Drawers arcade.draw_rectangle_outline(580, 200, 45, 30, arcade.color.BLACK, 2) arcade.draw_rectangle_outline(420, 200, 45, 30, arcade.color.BLACK, 2) arcade.draw_rectangle_outline(580, 250, 45, 30, arcade.color.BLACK, 2) arcade.draw_rectangle_outline(420, 250, 45, 30, arcade.color.BLACK, 2) # Knobs arcade.draw_point(580, 250, arcade.color.CYBER_GRAPE, 6) arcade.draw_point(580, 200, arcade.color.CYBER_GRAPE, 6) # Mirror Frame texture7 = arcade.load_texture("images/mirror.png") scale = .3 arcade.draw_texture_rectangle(499, 395, scale * texture7.width, scale * texture7.height, texture7, 0)
def draw_textstage1(): # Draw Textbox One arcade.draw_rectangle_filled(200, 140, 200, 50, arcade.color.WHITE) # Draw Outline One arcade.draw_rectangle_outline(200, 140, 200, 50, arcade.color.BLACK, 5) # Write Text One arcade.draw_text("What will Electrode do?", 110, 140, arcade.color.BLUE, 15) # Draw Textbox Two arcade.draw_rectangle_filled(450, 150, 240, 100, arcade.color.WHITE) # Draw Outline Two arcade.draw_rectangle_outline(450, 150, 240, 100, arcade.color.BLACK, 5) # Write Text Two arcade.draw_text("FIGHT BAG", 335, 155, arcade.color.BLUE, 25) # Write Text TwoTwo arcade.draw_text("POKéMON RUN", 335, 115, arcade.color.BLUE, 25) # Draw Stage1 arcade.draw_parabola_filled(135, 140, 250, 35, arcade.color.DARK_GREEN)
def on_draw(self): #circle arcade.start_render() arcade.draw_circle_filled(240, 360, 30, arcade.color.BLUE) arcade.draw_circle_outline(340, 360, 30, arcade.color.BUFF) #ellipse arcade.draw_ellipse_filled(100, 100, 50, 80, arcade.color.AQUA) arcade.draw_ellipse_outline(200, 100, 50, 80, arcade.color.AMETHYST) #rectangle arcade.draw_rectangle_filled(300, 100, 50, 50, arcade.color.RASPBERRY_GLACE) arcade.draw_rectangle_outline(400, 100, 50, 100, arcade.color.YANKEES_BLUE, 4) #text-szöveg arcade.draw_text("Kóder Klub", 20, 720 - 80, arcade.color.ALMOND, 24) #arc-iv arcade.draw_arc_filled(640, 720 - 80, 120, 120, arcade.color.YELLOW_GREEN, 0, 90) arcade.draw_arc_filled(1040, 720 - 80, 120, 120, arcade.color.GLITTER, 0, 180) #triangle arcade.draw_polygon_outline([[0, 0], [50, 0], [25, 50]], arcade.color.RAZZMIC_BERRY) #polygon arcade.draw_polygon_outline( [[640, 360], [640 + 50, 360], [640 + 75, 360 + 25], [640 + 25, 360 + 50], [640 - 25, 360 + 25]], arcade.color.EARTH_YELLOW)
def on_draw(self): arcade.start_render() self.window.set_viewport(0, self.width, 0, self.height) arcade.draw_text( "You win!", self.width // 2, self.height * 0.75, arcade.color.WHITE, 20, anchor_x="center", font_name=WIN_FONT, ) for field in self.field_list: field.draw() current_field = self.field_list[self.selection_index] arcade.draw_rectangle_outline( current_field.x, current_field.y + 8, self.width // 8, 30, arcade.csscolor.WHITE, ) self.draw_information_text(arcade.color.WHITE, nav=True)
def on_draw(): global player_x, player_y, new_var arcade.start_render() arcade.draw_rectangle_filled(player_x, player_y, 60, 30, arcade.color.BLUE) if not asds: arcade.draw_text("YOU LOST", WIDTH // 2 - 50, HEIGHT // 2, arcade.color.RED, 20, align="center") arcade.draw_text("You have " + str(points) + " points", 0, 440, arcade.color.WHITE, 20) else: arcade.draw_circle_filled(ball_X, ball_y, 10, arcade.color.RED) arcade.draw_text("You have " + str(points) + " points", 0, 440, arcade.color.WHITE, 20) if not new_var and asds: arcade.draw_rectangle_outline(WIDTH // 2 + 15, HEIGHT // 2 + 10, 50, 50, arcade.color.WHITE) arcade.draw_text("Start", WIDTH // 2, HEIGHT // 2, arcade.color.WHITE, 13) new_var = True elif new_var and not asds: arcade.draw_text("DONE", 10, 100, arcade.color.RED, 19)
def color_theme_draw(self): if self.highlighted: arcade.draw_rectangle_filled(self.x, self.y, self.width, self.height, self.highlight_color) else: arcade.draw_rectangle_filled(self.x, self.y, self.width, self.height, self.shadow_color) self.draw_text() arcade.draw_rectangle_outline(self.x, self.y, self.width, self.height, self.outline_color, 2)
def on_draw(self): arcade.start_render() arcade.draw_rectangle_filled(TOTAL_SIZE // 2, TOTAL_SIZE // 2, TOTAL_SIZE, TOTAL_SIZE, color=arcade.color.LIGHT_GRAY) arcade.draw_rectangle_filled((TOTAL_SIZE // 2) + 400, TOTAL_SIZE // 2, TOTAL_SIZE - 400, TOTAL_SIZE, color=arcade.color.LIGHT_GOLDENROD_YELLOW) arcade.draw_texture_rectangle(TOTAL_SIZE // 2, TOTAL_SIZE // 2, TOTAL_SIZE, TOTAL_SIZE, arcade.load_texture("chess_board.png")) for i in range(8): for j in range(8): if board.board[i][j] != 'e': x = (j * (TABLE_SIZE / 8)) + (TABLE_SIZE / 16) y = (i * (TABLE_SIZE / 8)) + (TABLE_SIZE / 16) arcade.draw_texture_rectangle(x, y, (TOTAL_SIZE / 8), (TOTAL_SIZE / 8), arcade.load_texture( "sprites/" + SPRITE_MAP[board.board[i][j]] + ".png")) if self.selection: arcade.draw_rectangle_outline(self.sy + 1, self.sx, (TOTAL_SIZE / 8) - 3, (TOTAL_SIZE / 8) - 3, arcade.color.GREEN, 4) for i in self.pos_mov: x = (i[0] * (TABLE_SIZE / 8)) + (TABLE_SIZE / 16) y = (i[1] * (TABLE_SIZE / 8)) + (TABLE_SIZE / 16) if board.board[i[0]][i[1]] != 'e': arcade.draw_rectangle_outline(y + 1, x, (TOTAL_SIZE / 8) - 3, (TOTAL_SIZE / 8) - 3, arcade.color.RED, 4) else: arcade.draw_circle_filled(y, x, 5, arcade.color.GREEN)
def draw_health_monster(self): if self.monster.live == 500: self.m_health = 100 elif 400 <= self.monster.live < 500: self.m_health = 83 elif 300 <= self.monster.live < 400: self.m_health = 66 elif 200 <= self.monster.live < 300: self.m_health = 50 elif 100 <= self.monster.live < 200: self.m_health = 33 elif 0 < self.monster.live < 100: self.m_health = 16 elif self.monster.live == 0: self.m_health = 0 arcade.draw_rectangle_filled(190, SCREEN_HEIGHT - 10, self.m_health, 10, arcade.color.GREEN) arcade.draw_rectangle_outline(190, SCREEN_HEIGHT - 10, 100, 10, arcade.color.WHITE) arcade.draw_text("MONSTER LIFE:", start_x=10, start_y=SCREEN_HEIGHT - 15, font_size=12, color=arcade.color.WHITE)
def on_draw(self): arcade.start_render() arcade.set_background_color((40, 40, 40)) arcade.draw_text("TARGET CELL", cel_1.cellx, cel_1.celly, (255, 0, 0), font_size=20) arcade.draw_text("Border = {}".format(round(self.border)), WIDTH - (WIDTH - 70), HEIGHT - 50, (255, 0, 0)) arcade.draw_rectangle_outline(WIDTH / 2, HEIGHT / 2, self.border * ROOT_2, self.border * ROOT_2, (0, 70, 0)) arcade.draw_line(WIDTH / 2, 0, WIDTH / 2, HEIGHT, (0, 80, 0)) arcade.draw_line(0, HEIGHT / 2, WIDTH, HEIGHT / 2, (0, 80, 0)) arcade.draw_circle_outline((WIDTH / 2), (HEIGHT / 2), self.border, (255, 255, 255)) if self.round_over: arcade.draw_text(self.winner, WIDTH / 2, HEIGHT - 100, (255, 255, 255), bold=True, font_size=20) for cell in self.cells: if cell != dead_cell: cell.draw() for x in range(len(self.nodes)): self.nodes[x].draw()
arcade.color.BLACK_BEAN, 45) # Draw an arc, and another one rotated arcade.draw_text("draw_arc/filled_arc", 123, 3, arcade.color.WHITE, 10) arcade.draw_arc_outline(150, 81, 15, 36, arcade.color.BRIGHT_MAROON, 90, 360) arcade.draw_arc_filled(150, 144, 15, 36, arcade.color.BOTTLE_GREEN, 90, 360, 45) # My drawing of PACMAN arcade.draw_arc_filled(300, 345, 36, 36, arcade.color.YELLOW, 90, 360, -45) # Draw an rectangle outline arcade.draw_text("draw_rect", 243, 3, arcade.color.WHITE, 10) arcade.draw_rectangle_outline(295, 100, 45, 65, arcade.color.BRITISH_RACING_GREEN) arcade.draw_rectangle_outline(295, 160, 20, 45, arcade.color.BRITISH_RACING_GREEN, 3, 45) # Draw a filled in rectangle arcade.draw_text("draw_filled_rect", 363, 3, arcade.color.WHITE, 10) arcade.draw_rectangle_filled(420, 100, 45, 65, arcade.color.BLUSH) arcade.draw_rectangle_filled(420, 160, 20, 40, arcade.color.BLUSH, 45) # Load and draw an image to the screen # Image from kenney.nl asset pack #1 arcade.draw_text("draw_bitmap", 483, 3, arcade.color.WHITE, 12) texture = arcade.load_texture("images/playerShip1_orange.png") scale = .6 arcade.draw_texture_rectangle(540, 120, scale * texture.width, scale * texture.height, texture, 0)