def draw_pine_tree(x, y): """ This function draws a pine tree at the specified location. """ # Draw the triangle on top of the trunk arcade.draw_triangle_filled(x + 40, y, x, y - 100, x + 80, y - 100, arcade.color.DARK_GREEN) # Draw the trunk arcade.draw_lrtb_rectangle_filled(x + 30, x + 50, y - 100, y - 140, arcade.color.DARK_BROWN)
def draw_background(): """ This function draws the background. Specifically, the sky and ground. """ # 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)
# Import the "arcade" library import arcade arcade.open_window(800, 600, "Iowa Perspective") # Set the background color arcade.set_background_color(arcade.color.BLACK) # Get ready to draw arcade.start_render() # Draw the grass arcade.draw_lrtb_rectangle_filled(0, 800, 200, 0, arcade.color.BITTER_LIME) # Barn 1 arcade.draw_lrtb_rectangle_filled(0, 180, 380, 168.5, arcade.color.BARN_RED) # Barn Door 1 arcade.draw_rectangle_filled(80, 190, 65, 45.5, arcade.color.BLACK_LEATHER_JACKET) # Barn Window 1 arcade.draw_rectangle_filled(80, 280, 60, 30, arcade.color.ANTIQUE_WHITE) arcade.draw_rectangle_filled(80, 280, 50, 15, arcade.color.BLACK) # Barn 2 arcade.draw_lrtb_rectangle_filled(530, 720, 380, 168.5, arcade.color.BARN_RED) # Barn Door 2 arcade.draw_rectangle_filled(630, 190, 65, 45.5, arcade.color.BLACK_LEATHER_JACKET) # Barn Window 2
import arcade SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing with Functions") arcade.set_background_color(arcade.color.DARK_BLUE) arcade.start_render() # Draw the ground arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3, 0, arcade.color.AIR_SUPERIORITY_BLUE) # Draw a snow person # Snow arcade.draw_circle_filled(300, 200, 60, arcade.color.WHITE) arcade.draw_circle_filled(300, 280, 50, arcade.color.WHITE) arcade.draw_circle_filled(300, 340, 40, arcade.color.WHITE) # Eyes arcade.draw_circle_filled(285, 350, 5, arcade.color.BLACK) arcade.draw_circle_filled(315, 350, 5, arcade.color.BLACK) # Finish and run arcade.finish_render() arcade.run()
def on_draw(self): """Draw the chat box elements.""" super().on_draw() self.send_box.on_draw() text_color = arcade.color.BLACK start_pos = self.send_box.top n = 1 # build chat bloops from bottom up, will solve most issues msg_pool = self.messages if self.scroll_offset > 0: calc_offset = max(len(msg_pool) - self.scroll_offset, 15) msg_pool = self.messages[:calc_offset] for cm in reversed(msg_pool): if cm.sender == self.player_worker: # Message goes to right side left = self.left + 100 color = arcade.color.GRAY box_width = 33 else: left = self.left + self.border_width + 30 color = arcade.color.WHITE box_width = 36 right = self.right - self.border_width lines = math.ceil(len(cm.text) / box_width) msg_lines = [] if lines > 1: # insert newlines for word wrap words = cm.text.split() while len(words) > 0: chunk = '' while len(chunk) < box_width - 6 and len(words) > 0: chunk = chunk + ' ' + words.pop(0) msg_lines.append(chunk) lines = len(msg_lines) # update lines estimate with actual text = '\n'.join(msg_lines) else: text = cm.text height = MESSAGE_LINE_HEIGHT * lines lines_height = n * (MESSAGE_LINE_HEIGHT + MSG_GAP) bottom = start_pos - self.border_width - 5 + lines_height top = bottom + height # Stop rendering once window is full if top > self.top - self.border_width: break # draw chat msg rect arcade.draw_lrtb_rectangle_filled(left, right, top, bottom, color) # draw icon (if worker) if cm.sender != self.player_worker: arcade.draw_circle_filled(left - 15, top - 15, 15, cm.sender.color) # draw words for message arcade.draw_text(text, left + 4, bottom + 4 * lines, text_color, font_size=MESSAGE_FONT_SIZE, font_name=FONTS, anchor_x='left', anchor_y='bottom') n = n + lines # Increment messages, accounting for multilines
def draw_island(): arcade.draw_lrtb_rectangle_filled(200, 600, 100, 0, arcade.color.SLATE_GRAY)
import arcade # this is a test arcade.open_window(1280, 720, "720p Window Test") arcade.set_background_color(arcade.csscolor.SKY_BLUE) arcade.start_render() arcade.draw_lrtb_rectangle_filled(0, 1279, 300, 0, arcade.csscolor.GREEN) arcade.draw_rectangle_filled(100, 320, 20, 60, arcade.csscolor.SIENNA) arcade.draw_circle_filled(100, 350, 30, arcade.csscolor.DARK_GREEN) arcade.draw_ellipse_filled(100, 350, 85, 45, arcade.csscolor.DARK_GREEN) arcade.draw_ellipse_filled(100, 370, 35, 37, arcade.csscolor.DARK_GREEN) arcade.draw_rectangle_filled(300, 320, 20, 60, arcade.csscolor.SIENNA) arcade.draw_arc_filled(300, 340, 60, 100, arcade.csscolor.DARK_GREEN, 0, 180) arcade.draw_ellipse_filled(center_x=800, center_y=500, width=30, height=40, color=arcade.csscolor.DARK_RED) arcade.finish_render() arcade.run()
def draw_grass(): """ This function draws the grass. """ arcade.draw_lrtb_rectangle_filled(0, 800, 200, 0, arcade.color.BITTER_LIME)
# Open up a window. # From the "arcade" library, use a function called "open_window" # Set the window title to "Drawing Example" # Set the and dimensions (width and height) arcade.open_window(800, 600, "Drawing Example") # Set the background color arcade.set_background_color(arcade.color.COAL) # Get ready to draw arcade.start_render() # Draw the grass arcade.draw_lrtb_rectangle_filled(0, 800, 350, 0, arcade.color.BUD_GREEN) arcade.draw_lrtb_rectangle_filled(0, 800, 350, 315, (214, 188, 71)) # Drawing the 'river' arcade.draw_rectangle_filled(400, 200, 80, 1000, arcade.color.CORNFLOWER_BLUE, 80) ''' arcade.draw_line(100, 170, 170, 182, (51, 110, 214)) arcade.draw_line(100, 160, 170, 162, (51, 110, 214)) arcade.draw_line(100, 170, 170, 182, (51, 110, 214))''' # Draw the mountains arcade.draw_triangle_filled(-100, 350, 150, 500, 320, 350, arcade.color.DARK_GRAY) arcade.draw_triangle_filled(200, 350, 400, 450, 600, 350, arcade.color.DARK_GRAY)
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
# Start by importing arcade. import arcade arcade.open_window(600, 600, "Drawing Lab") # This places the sky blue background color. arcade.set_background_color(arcade.csscolor.SKY_BLUE) # This is the start of the drawing. arcade.start_render() # Draw grass. arcade.draw_lrtb_rectangle_filled(0, 599, 199, 0, arcade.csscolor.GREEN) # Draw a sun. arcade.draw_circle_filled(50, 549, 50, arcade.csscolor.YELLOW) # Draw a trail using the polygon function. arcade.draw_polygon_filled(((0, 150), (125, 115), (325, 165), (599, 135), (599, 95), (325, 125), (125, 75), (0, 110)), arcade.csscolor.DARK_GRAY) # Draw the trunk of tree 1. arcade.draw_lrtb_rectangle_filled(120, 145, 250, 175, arcade.csscolor.BROWN) # Draw a triangle shaped top of tree 1. arcade.draw_triangle_filled(100, 250, 165, 250, 132.5, 300, arcade.csscolor.GREEN) # Draw a trunk of tree 2. arcade.draw_lrtb_rectangle_filled(350, 380, 275, 170, arcade.csscolor.BROWN)
def draw_tree(x, y): arcade.draw_triangle_filled(x - 50, y, x + 50, y, x, y + 100, arcade.color.MSU_GREEN) arcade.draw_lrtb_rectangle_filled(x - 25, x + 25, y, y - 70, arcade.color.BROWN)
def set_background(): arcade.draw_lrtb_rectangle_filled(0, window_width, window_height * (1 / 3), 0, arcade.color.DARK_SPRING_GREEN) arcade.draw_lrtb_rectangle_filled(0, window_width, window_height, window_height * (1 / 3), arcade.color.SKY_BLUE)
def on_draw(self): arcade.start_render() arcade.draw_lrtb_rectangle_filled(0, 600, 600, 570, arcade.color.RED) arcade.draw_lrtb_rectangle_filled(0, 30, 600, 0, arcade.color.YELLOW) arcade.draw_lrtb_rectangle_filled(570, 600, 600, 0, arcade.color.BLUE) arcade.draw_lrtb_rectangle_filled(0, 600, 30, 0, arcade.color.GREEN) arcade.draw_lrtb_rectangle_filled(0, 30, 600, 570, arcade.color.WHITE) arcade.draw_lrtb_rectangle_filled(0, 30, 30, 0, arcade.color.WHITE) arcade.draw_lrtb_rectangle_filled(570, 600, 600, 570, arcade.color.WHITE) arcade.draw_lrtb_rectangle_filled(570, 600, 30, 0, arcade.color.WHITE) for item in self.list: item.draw_rectangle()
def draw_ice(): """ Draw the ground """ arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3, 0, arcade.color.AIR_SUPERIORITY_BLUE)
If you have 5 lines that draw a robot, group them together with blank lines above and below. Then add a comment at the top telling the reader what you are drawing. IN THE WINDOW TITLE PLEASE PUT YOUR NAME. When you are finished Pull Request your file to your instructor. ''' import arcade arcade.open_window(450, 800, "Daniel Mitchell Pycasso") arcade.set_background_color((0, 0, 0)) arcade.start_render() #draw body arcade.draw_circle_filled(40, 750, 30, arcade.color.COOL_GREY, 127) arcade.draw_circle_filled(410, 750, 30, arcade.color.COOL_GREY, 127) arcade.draw_circle_filled(40, 50, 30, arcade.color.COOL_GREY, 127) arcade.draw_circle_filled(410, 50, 30, arcade.color.COOL_GREY, 127) arcade.draw_lrtb_rectangle_filled(10, 440, 750, 55, arcade.color.COOL_GREY) arcade.draw_lrtb_rectangle_filled(40, 410, 780, 20, arcade.color.COOL_GREY) arcade.draw_lrtb_rectangle_filled(35, 415, 735, 485, arcade.color.WHITE) arcade.draw_text("420 / 69", 50, 690, arcade.color.BLACK, 25) arcade.draw_text("6.086956522", 240, 660, arcade.color.BLACK, 25) arcade.draw_text("............................................", 50, 640, arcade.color.BLACK, 25) arcade.draw_text("............................................", 50, 720, arcade.color.BLACK, 25) for b_off in range(0, 350, 70): #draw Fbuttons #arcade.draw_lrtb_rectangle_filled(45, 85, 475, 455, arcade.color.WHITE_SMOKE) arcade.draw_rectangle_filled((80 + (b_off)), 460, 45, 15, arcade.color.WHITE_SMOKE) for m_off in range(0, 200, 40): #draws the buttons to the left of the dpad
# Open up a window. # From the "arcade" library, use a function called "open_window" # Set the window title to "Drawing Example" # Set the and dimensions (width and height) arcade.open_window(800, 600, "Drawing Example") # Set the background color arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE) # Get ready to draw arcade.start_render() # Draw the grass arcade.draw_lrtb_rectangle_filled(0, 800, 200, 0, arcade.color.BITTER_LIME) # --- Draw the barn --- # Barn cement base arcade.draw_lrtb_rectangle_filled(30, 350, 210, 170, arcade.color.BISQUE) # Bottom half arcade.draw_lrtb_rectangle_filled(30, 350, 350, 210, arcade.color.BROWN) # Left-bottom window arcade.draw_rectangle_filled(70, 260, 30, 40, arcade.color.BONE) arcade.draw_rectangle_filled(70, 260, 20, 30, arcade.color.BLACK) # Right-bottom window arcade.draw_rectangle_filled(310, 260, 30, 40, arcade.color.BONE)
# Open up a window. # From the "arcade" library, use a function called "open_window" # Set the window title to "Drawing Example" # Set the and dimensions (width and height) arcade.open_window(600, 600, "Drawing Example") # Set the background color arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE) # Get ready to draw arcade.start_render() # Draw a rectangle # Left of 5, right of 35 # Top of 590, bottom of 570 arcade.draw_lrtb_rectangle_filled(5, 35, 590, 570, arcade.color.BITTER_LIME) # Different way to draw a rectangle # Center rectangle at (100, 520) with a width of 45 and height of 25 arcade.draw_rectangle_filled(100, 520, 45, 25, arcade.color.BLUSH) # Rotate a rectangle # Center rectangle at (200, 520) with a width of 45 and height of 25 # Also, rotate it 45 degrees. arcade.draw_rectangle_filled(200, 520, 45, 25, arcade.color.BLUSH, 45) # Draw a point at (50, 580) that is 5 pixels large arcade.draw_point(50, 580, arcade.color.RED, 5) # Draw a line
def on_draw(self): arcade.start_render() arcade.draw_lrtb_rectangle_filled(self.a_x, self.a_x + 30, self.a_y + 30, self.a_y, arcade.color.BLACK) arcade.draw_lrtb_rectangle_filled(self.b_x, self.b_x + 50, self.b_y + 50, self.b_y, arcade.color.BLACK) arcade.draw_lrtb_rectangle_filled(self.c_x, self.c_x + 40, self.c_y + 40, self.c_y, arcade.color.YELLOW) arcade.draw_lrtb_rectangle_filled(self.d_x, self.d_x + 40, self.d_y + 40, self.d_y, arcade.color.YELLOW) arcade.draw_lrtb_rectangle_filled(500, 525, 525, 500, arcade.color.RED) arcade.draw_lrtb_rectangle_filled(500, 525, 100, 75, arcade.color.RED) arcade.draw_lrtb_rectangle_filled(75, 100, 525, 500, arcade.color.RED) arcade.draw_lrtb_rectangle_filled(self.player_x, self.player_x + 25, self.player_y, self.player_y - 25, arcade.color.GREEN)
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()
arcade.draw_circle_outline(302, 302, 100, arcade.color.BARBIE_PINK) # Rays to the left, right, up, and down arcade.draw_line(300, 300, 50, 300, arcade.color.YELLOW, 3) arcade.draw_line(300, 300, 550, 300, arcade.color.YELLOW, 3) arcade.draw_line(300, 300, 300, 550, arcade.color.YELLOW, 3) arcade.draw_line(300, 300, 300, 50, arcade.color.YELLOW, 3) # Diagonal rays arcade.draw_line(300, 350, 500, 400, arcade.color.YELLOW, 3) arcade.draw_line(300, 350, 100, 400, arcade.color.YELLOW, 3) # Draw a rectangle # Left of 0, right of 599 # Top of 300, bottom of 0 arcade.draw_lrtb_rectangle_filled(0, 599, 300, 0, arcade.color.AZURE) # Draw text at (150, 230) with a font size of 24 pts. arcade.draw_text("Sunrise on a Lake", 150, 230, arcade.color.BLACK, 24) # Tree trunk # Center of 100, 320 # Width of 20 # Height of 60 arcade.draw_rectangle_filled(50, 300, 20, 60, arcade.csscolor.SIENNA) # Tree top arcade.draw_circle_filled(50, 350, 30, arcade.csscolor.DARK_GREEN) # Draw a tree using a polygon with a list of points arcade.draw_rectangle_filled(500, 320, 20, 60, arcade.csscolor.SIENNA)
""" Drawing a football field """ import arcade arcade.open_window(800, 600, "Football Field") # Dark blue as background colour arcade.set_background_color((10, 2, 71)) arcade.start_render() # Draw a dark green rectangle at the bottom part arcade.draw_lrtb_rectangle_filled(0, 800, 100, 0, (28, 41, 1)) # Draw a dark green trapeze rounding the field arcade.draw_polygon_filled( [[0, 100], [0, 200], [180, 530], [620, 530], [800, 200], [800, 100]], (28, 41, 1)) # Draw a light green trapeze to get depth arcade.draw_polygon_filled([[0, 100], [210, 500], [590, 500], [800, 100]], (102, 138, 25)) # Remark borders with a white line arcade.draw_polygon_outline([[0, 100], [210, 500], [590, 500], [800, 100]],
import arcade arcade.open_window(600, 600, "Drawing Example") arcade.set_background_color(arcade.csscolor.ALICE_BLUE) arcade.start_render() # flag pole arcade.draw_lrtb_rectangle_filled(50, 80, 550, 0, arcade.csscolor.GRAY) # hill arcade.draw_ellipse_filled(300, 0, 600, 200, arcade.csscolor.GREEN, 0) # japanese flag arcade.draw_lrtb_rectangle_filled(60, 450, 570, 370, arcade.csscolor.WHITE) arcade.draw_circle_filled(255, 470, 60, arcade.csscolor.RED) # flower arcade.draw_line(300, 100, 300, 150, arcade.csscolor.GREEN, 5) arcade.finish_render() arcade.run()
def main(): arcade.open_window(800, 600, "Iowa Perspective/Drawing with Functions") arcade.set_background_color(arcade.color.BLACK) arcade.start_render() draw_cloud(50, 50) draw_cloud2(20, 20) draw_shed(10, 10) # Barn 1 arcade.draw_lrtb_rectangle_filled(0, 180, 380, 168.5, arcade.color.BARN_RED) # Barn Door 1 arcade.draw_rectangle_filled(80, 190, 65, 45.5, arcade.color.BLACK_LEATHER_JACKET) # Barn Window 1 arcade.draw_rectangle_filled(80, 280, 60, 30, arcade.color.ANTIQUE_WHITE) arcade.draw_rectangle_filled(80, 280, 50, 15, arcade.color.BLACK) # Barn 2 arcade.draw_lrtb_rectangle_filled(530, 720, 380, 168.5, arcade.color.BARN_RED) # Barn Door 2 arcade.draw_rectangle_filled(630, 190, 65, 45.5, arcade.color.BLACK_LEATHER_JACKET) # Barn Window 2 arcade.draw_rectangle_filled(630, 280, 60, 30, arcade.color.ANTIQUE_WHITE) arcade.draw_rectangle_filled(630, 280, 50, 15, arcade.color.BLACK) # Shed 2 arcade.draw_rectangle_filled(760, 215, 98, 94, arcade.color.BARN_RED) arcade.draw_rectangle_filled(760, 190, 40, 45, arcade.color.BLACK_LEATHER_JACKET) # Windows of Shed 2 arcade.draw_rectangle_filled(760, 220, 60, 20, arcade.color.ANTIQUE_WHITE) arcade.draw_rectangle_filled(760, 220, 50, 10, arcade.color.BLACK) # River arcade.draw_rectangle_filled(420, 0, 60, 400, arcade.color.BLUE) # Dirt side of River left arcade.draw_rectangle_filled(390, 0, 10, 400, arcade.color.DARK_BROWN) # Dirt side of River right arcade.draw_rectangle_filled(445, 0, 10, 400, arcade.color.DARK_BROWN) # Stars arcade.draw_circle_filled(730, 575, 2, arcade.color.YELLOW) arcade.draw_circle_filled(680, 575, 2, arcade.color.YELLOW) arcade.draw_circle_filled(500, 580, 2, arcade.color.YELLOW) arcade.draw_circle_filled(695, 580, 2, arcade.color.YELLOW) arcade.draw_circle_filled(685, 580, 2, arcade.color.YELLOW) arcade.draw_circle_filled(740, 580, 2, arcade.color.YELLOW) arcade.draw_circle_filled(500, 500, 2, arcade.color.YELLOW) arcade.draw_circle_filled(510, 500, 2, arcade.color.YELLOW) arcade.draw_circle_filled(450, 490, 2, arcade.color.YELLOW) arcade.draw_circle_filled(480, 700, 2, arcade.color.YELLOW) arcade.draw_circle_filled(380, 600, 2, arcade.color.YELLOW) arcade.draw_circle_filled(745, 500, 2, arcade.color.YELLOW) arcade.draw_circle_filled(687, 510, 2, arcade.color.YELLOW) arcade.draw_circle_filled(210, 520, 2, arcade.color.YELLOW) arcade.draw_circle_filled(510, 537, 2, arcade.color.YELLOW) arcade.draw_circle_filled(340, 550, 2, arcade.color.YELLOW) arcade.draw_circle_filled(200, 555, 2, arcade.color.YELLOW) arcade.draw_circle_filled(250, 550, 2, arcade.color.YELLOW) arcade.draw_circle_filled(683, 418, 2, arcade.color.YELLOW) arcade.draw_circle_filled(688, 450, 2, arcade.color.YELLOW) arcade.draw_circle_filled(699, 475, 2, arcade.color.YELLOW) arcade.draw_circle_filled(300, 280, 2, arcade.color.YELLOW) arcade.draw_circle_filled(400, 520, 2, arcade.color.YELLOW) arcade.draw_circle_filled(200, 530, 2, arcade.color.YELLOW) arcade.draw_circle_filled(500, 350, 2, arcade.color.YELLOW) arcade.draw_circle_filled(666, 500, 2, arcade.color.YELLOW) arcade.draw_circle_filled(400, 300, 2, arcade.color.YELLOW) arcade.draw_circle_filled(475, 375, 2, arcade.color.YELLOW) arcade.draw_circle_filled(490, 400, 2, arcade.color.YELLOW) arcade.draw_circle_filled(380, 380, 2, arcade.color.YELLOW) arcade.draw_circle_filled(375, 325, 2, arcade.color.YELLOW) arcade.draw_circle_filled(325, 400, 2, arcade.color.YELLOW) # Moon arcade.draw_circle_filled(785, 525, 85, arcade.color.GHOST_WHITE) # Shed 2 arcade.draw_rectangle_filled(760, 215, 98, 94, arcade.color.BARN_RED) arcade.draw_rectangle_filled(760, 190, 40, 45, arcade.color.BLACK_LEATHER_JACKET) # Windows of Shed 2 arcade.draw_rectangle_filled(760, 220, 60, 20, arcade.color.ANTIQUE_WHITE) arcade.draw_rectangle_filled(760, 220, 50, 10, arcade.color.BLACK) # --- Finish drawing --- arcade.finish_render() # Keep the window up until someone closes it. arcade.run()
def draw_water(): arcade.draw_lrtb_rectangle_filled(0, 800, 300, 0, arcade.color.SEA_BLUE)
def dibujar_fondo(): """ Draw the ground """ arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3, 0, arcade.color.ARYLIDE_YELLOW)
def draw_door(): # Frame arcade.draw_lrtb_rectangle_filled(376, 424, 153, 100, arcade.color.DARK_BROWN) # Inside door arcade.draw_lrtb_rectangle_filled(380, 420, 150, 100, arcade.color.BLACK)
#THE CAR #The car tires arcade.draw_circle_filled(350, 150, 30, arcade.color.BLACK) arcade.draw_circle_filled(600, 150, 30, arcade.color.BLACK) #The wheels arcade.draw_circle_filled(350, 150, 25, arcade.color.WHITE) arcade.draw_circle_filled(600, 150, 25, arcade.color.WHITE) arcade.draw_circle_filled(350, 150, 20, arcade.color.BLACK) arcade.draw_circle_filled(600, 150, 20, arcade.color.BLACK) #rear and front fender x = 350 y = 150 width = 40 height = 40 start_angle = 5 end_angle = 178 arcade.draw_arc_outline(x, y, width, height, arcade.color.RED, start_angle, end_angle, 10) arcade.draw_arc_outline(600, 150, 40, 40, arcade.color.RED, 5, 178, 10) #Body arcade.draw_lrtb_rectangle_filled(390, 560, 250, 152, arcade.color.RED) arcade.draw_line(555, 249, 640, 160, arcade.color.RED, 4) arcade.draw_line(390, 249, 308, 160, arcade.color.RED, 4) #The Sun arcade.draw_circle_filled(750, 600, 110, arcade.color.ORANGE_PEEL) arcade.draw_circle_filled(750, 600, 100, arcade.color.YELLOW_ORANGE) #The Clouds arcade.draw_ellipse_filled(200, 500, 275, 75, arcade.color.WHITE_SMOKE) arcade.finish_render() arcade.run()
(530, 320), (520, 360) ), arcade.csscolor.DARK_GREEN) def open_window(): # From the "arcade" library, use a function called "open_window" # Set the window title to "Drawing Example" # Set the and dimensions (width and height) arcade.open_window(800, 600, "A Beautiful Sunday") arcade.start_render() open_window() # Draw the cement arcade.draw_lrtb_rectangle_filled(0, 800, 200, 0, arcade.color.BROWN_NOSE) sun() tree_one() tree_two() tree_three() # --- Finish drawing --- arcade.finish_render() # Keep the window up until someone closes it. arcade.run()
BLACK, ALMOND, PHLOX, BLUSH, RED, BLUE, WISTERIA, AMBER, BRICK_RED and YELLOW. The picture is 500px wide and 400px tall. Look up ARC in the documentation to do the PAC-MAN.\ ''' import arcade arcade.open_window(500,400,"Jedi Training") arcade.set_background_color((239, 222, 205)) arcade.start_render() for x_off in range(0,500,20): arcade.draw_line((x_off), 0, (x_off), 400, arcade.color.BLACK, 2) for y_off in range(0,400,20): arcade.draw_line(0, (y_off), 500, (y_off), arcade.color.BLACK, 2) arcade.draw_lrtb_rectangle_filled(20, 80, 380, 360, (223, 0, 255)) arcade.draw_line(80, 20, 120, 60, arcade.color.BLUE, 1) arcade.draw_circle_filled(250, 200, 40, arcade.color.WISTERIA) arcade.draw_ellipse_filled(100, 100, 120, 40, arcade.color.AMBER) arcade.draw_rectangle_filled(200, 260, 40, 20, arcade.color.BLUSH, 135) arcade.draw_text("I love you. I know.", 45, 155, arcade.color.BRICK_RED, 20) arcade.draw_arc_filled(400,320,120,120,arcade.color.YELLOW,30,330) arcade.finish_render()
def draw_grass(): """ Draw the ground """ arcade.draw_lrtb_rectangle_filled(0, WIDTH, HEIGHT / 3, 0, arcade.color.AIR_SUPERIORITY_BLUE)
import arcade arcade.open_window(600, 600, "Drawing Example") arcade.set_background_color(arcade.csscolor.AQUAMARINE) arcade.draw_lrtb_rectangle_filled(0, 599, 300, 0, arcade.csscolor.GREEN) arcade.start_render() arcade.draw_lrtb_rectangle_filled(0, 599, 300, 0, arcade.csscolor.BLACK) arcade.draw_rectangle_filled(100, 320, 20, 60, arcade.csscolor.BROWN) arcade.draw_circle_filled(100, 350, 30, arcade.csscolor.BROWN) arcade.draw_ellipse_filled(200, 370, 60, 80, arcade.csscolor.BROWN) arcade.finish_render() arcade.run()