def on_draw(self): """ Draw the face """ arcade.start_render() #Face is set to the center defined above face_x, face_y = (self.x, self.y) #Set mouth positon on face smile_x, smile_y = (face_x + 0, face_y - 10) #Set left eye position eye1_x, eye1_y = (face_x - 30, face_y + 20) #Set right eye position eye2_x, eye2_y = (face_x + 30, face_y + 20) #Set left eye catch position catch1_x, catch1_y = (face_x - 25, face_y + 25) #Set right eye catch position catch2_x, catch2_y = (face_x + 35, face_y + 25) #Draw yellow base arcade.draw_circle_filled(face_x, face_y, 100, open_color.yellow_3) #Draw outline arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) #Draw left eye arcade.draw_ellipse_filled(eye1_x, eye1_y, 15, 25, open_color.black) #Draw right eye arcade.draw_ellipse_filled(eye2_x, eye2_y, 15, 25, open_color.black) #Draw left eye catch arcade.draw_circle_filled(catch1_x, catch1_y, 3, open_color.gray_2) #Draw right eye catch arcade.draw_circle_filled(catch2_x, catch2_y, 3, open_color.gray_2) #Draw mouth arcade.draw_arc_outline(smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4)
def draw_BB8(x, y, radius): arcade.draw_circle_filled(x, y, radius, arcade.color.WHITE) # Body + Outline arcade.draw_circle_outline(x, y, radius, arcade.color.BLACK, 2.5) arcade.draw_circle_filled(x, y, radius / 10 * 6.5, arcade.color.ORANGE) # Fist circle + outline arcade.draw_circle_outline(x, y, radius / 10 * 6.5, arcade.color.BLACK, 2.5) arcade.draw_circle_filled( x, y, radius / 10 * 3.5, arcade.color.BABY_BLUE) # Second circle + outline arcade.draw_circle_outline(x, y, radius / 10 * 3.5, arcade.color.BLACK, 2) arcade.draw_arc_filled(x + radius / 10 * .2, y + radius - 5, radius, radius, arcade.color.WHITE, 0, 180) # White arch + outline arcade.draw_arc_outline(x + radius / 10 * .2, y + radius - 5, radius, radius, arcade.color.BLACK, 0, 180, 2.5) arcade.draw_line(x - radius, y + radius - 5, x + radius, y + radius - 5, arcade.color.BLACK, 2.5) arcade.draw_circle_filled( x, y + radius / 2 * 3 - 3.75, radius / 10 * 2.5, arcade.color.BLUE_GRAY) # Blue circle in arch + outline arcade.draw_circle_outline(x, y + radius / 2 * 3 - 3.75, radius / 10 * 2.5, arcade.color.BLACK, 2.5)
def on_draw( self): # this is another function which actually draws the smiley """ Draw the face """ arcade.start_render() face_x, face_y = ( self.x, self.y ) # the use of self here indicates that the smiley would go wherever the mouse would go smile_x, smile_y = ( face_x + 0, face_y - 10 ) # these are the coordinates of smiley and all its parts eye1_x, eye1_y = (face_x - 30, face_y + 20) eye2_x, eye2_y = (face_x + 30, face_y + 20) catch1_x, catch1_y = (face_x - 25, face_y + 25) catch2_x, catch2_y = (face_x + 35, face_y + 25) arcade.draw_circle_filled( face_x, face_y, 100, open_color.yellow_3 ) #lines 37-43 draws the smiiley also giving its parts specific colors to make it look like a smiley arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) arcade.draw_ellipse_filled(eye1_x, eye1_y, 15, 25, open_color.black) arcade.draw_ellipse_filled(eye2_x, eye2_y, 15, 25, open_color.black) arcade.draw_circle_filled(catch1_x, catch1_y, 3, open_color.gray_2) arcade.draw_circle_filled(catch2_x, catch2_y, 3, open_color.gray_2) arcade.draw_arc_outline(smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4)
def on_draw(self): """ Draw the face """ arcade.start_render() face_x, face_y = (self.x, self.y) #drawing the face smile_x, smile_y = (face_x + 0, face_y - 10) #drawing the smile eye2_x, eye2_y = (face_x + 30, face_y + 20) #Drawing the eyes catch1_x, catch1_y = (face_x - 25, face_y + 25) #Drawing the iris catch2_x, catch2_y = (face_x + 35, face_y + 25) #Drawing the iris arcade.draw_circle_filled( face_x, face_y, 100, open_color.yellow_3) #drawing the face with yellow background arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) #drawing a black outline for the face arcade.draw_ellipse_filled( eye1_x, eye1_y, 15, 25, open_color.black) #drawing the eye with fill color black arcade.draw_ellipse_filled( eye2_x, eye2_y, 15, 25, open_color.black) #drawing the eye with fill color black arcade.draw_circle_filled( catch1_x, catch1_y, 3, open_color.gray_2) #drawing the iris with fill color gray arcade.draw_circle_filled( catch2_x, catch2_y, 3, open_color.gray_2) #drawing the iris with fill color gray arcade.draw_arc_outline( smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4) #drawing the arc for the smile with fill color black
def draw_BB8(x, y, radius): arcade.draw_circle_filled(x, y, radius, arcade.color.WHITE) arcade.draw_circle_outline(x, y, radius, arcade.color.BLACK, 3) arcade.draw_circle_filled(x, y, radius / 1.5, arcade.color.ORANGE) arcade.draw_circle_outline(x, y, radius / 1.5, arcade.color.BLACK, 3) arcade.draw_circle_filled(x, y, radius / 3, arcade.color.LIGHT_STEEL_BLUE) arcade.draw_circle_outline(x, y, radius / 3, arcade.color.BLACK, 3) arcade.draw_arc_filled( x, y + radius * .9, radius * 1.2, radius * 1.3, arcade.color.WHITE, 0, 180, ) arcade.draw_arc_outline(x, y + radius * .9, radius * 1.2, radius * 1.3, arcade.color.BLACK, 0, 180, 6) arcade.draw_rectangle_filled(x, y + radius * .9, radius * 1.2, 3, arcade.color.BLACK) arcade.draw_circle_filled(x, y + radius * 1.2, radius / 5, arcade.color.BLUE_GRAY) arcade.draw_circle_outline(x, y + radius * 1.2, radius / 5, arcade.color.BLACK, 3)
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 draw(self): # Smiley drawing goes here #Open the window and set window title x = 300 y = 300 radius = 200 arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW) x = 210 y = 400 radius = 20 arcade.draw_circle_filled(x, y, radius, arcade.color.WHITE_SMOKE) x = 400 y = 400 radius = 20 arcade.draw_circle_filled(x, y, radius, arcade.color.WHITE_SMOKE) # Draw the smile x = 300 y = 280 width = 120 height = 100 start_angle = 190 end_angle = 350 arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle, end_angle, 10)
def on_draw(self): """ Draw the face """ #This is placing the smiley in the middle of the screen to begin with arcade.start_render() face_x, face_y = ( self.x, self.y ) #is this connected to lines 46-49? These lines place the full picture in the middle of the screen with the coordinates making up a smiley and not a terrifying cyclops or some other beast smile_x, smile_y = (face_x + 0, face_y - 10) eye1_x, eye1_y = (face_x - 30, face_y + 20) eye2_x, eye2_y = (face_x + 30, face_y + 20) catch1_x, catch1_y = (face_x - 25, face_y + 25) catch2_x, catch2_y = (face_x + 35, face_y + 25) arcade.draw_circle_filled( face_x, face_y, 100, open_color.yellow_3 ) #This is the line that make up the yellow circle background arcade.draw_circle_outline( face_x, face_y, 100, open_color.black, 4 ) #This is the line that creates the solid black outline for the smiley arcade.draw_ellipse_filled( eye1_x, eye1_y, 15, 25, open_color.black) #These two lines are the black circles, or eyes arcade.draw_ellipse_filled(eye2_x, eye2_y, 15, 25, open_color.black) arcade.draw_circle_filled( catch1_x, catch1_y, 3, open_color.gray_2 ) #These two lines are made for the two reflections in the eyes arcade.draw_circle_filled(catch2_x, catch2_y, 3, open_color.gray_2) arcade.draw_arc_outline( smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4 ) #This line is the arc, or the actual curved line making the smile
def moon_outline(center_x: float, center_y: float, radius: float, phase_ratio: float, color, border_width: float = 1, tilt_angle: float = 0, num_segments: int = 128): """ Draws the outline of a crescent moon. :param center_x: x position that is the center of the moon. :param center_y: y position that is the center of the moon. :param radius: radius of the moon. :param phase_ratio: how "crescent" the moon is. 0 = half moon, 1 = new moon, -1 = full moon, etc. :param color: color, specified in a list of 3 or 4 bytes in RGB or RGBA format. :param border_width: width of lines in pixels. :param tilt_angle: angle the moon is tilted. :param num_segments: float of triangle segments that make up this circle. Higher is better quality, but slower render time. """ # Making variables from original variables diameter = radius * 2 phase = phase_ratio * diameter # Drawing moon outer line circle_arc_outline(center_x, center_y, radius, color, -90, 90, border_width, -tilt_angle, num_segments) # Drawing moon inner line arcade.draw_arc_outline(center_x, center_y, phase, diameter, color, -90, 90, border_width, -tilt_angle, num_segments)
def draw_bird(x, y): """Draw a bird""" arcade.draw_circle_filled(x + 0, y + 2, 8, arcade.color.CHARLESTON_GREEN) arcade.draw_arc_outline(x - 17, y - 3, 35, 30, arcade.color.CHARLESTON_GREEN, 0, 180, 5) arcade.draw_arc_outline(x + 18, y - 3, 35, 30, arcade.color.CHARLESTON_GREEN, 0, 180, 5)
def on_draw(self): """ Draw the face """ #This line initializes the rendering arcade.start_render() #Sets the center of the face to the middle of the screen to start face_x, face_y = (self.x, self.y) #Changed these three lines to make the picture closer to the example #Each of the next 5 non-comment lines draw the face, all of the positioning relative to the center #of the outline smile_x, smile_y = (face_x + 0, face_y + 0) eye1_x, eye1_y = (face_x - 30, face_y + 50) eye2_x, eye2_y = (face_x + 30, face_y + 50) #Changed shine position to be closer to example catch1_x, catch1_y = (face_x - 25, face_y + 63) catch2_x, catch2_y = (face_x + 35, face_y + 63) #Again, changed eye size to match example #These arcade.draw lines just color the face, specifically: #The whole face yellow arcade.draw_circle_filled(face_x, face_y, 100, open_color.yellow_3) #The outline black arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) #The two eyes black arcade.draw_ellipse_filled(eye1_x, eye1_y, 30, 50, open_color.black) arcade.draw_ellipse_filled(eye2_x, eye2_y, 30, 50, open_color.black) #The shining of the eyes gray arcade.draw_circle_filled(catch1_x, catch1_y, 3, open_color.gray_2) arcade.draw_circle_filled(catch2_x, catch2_y, 3, open_color.gray_2) #And the smile black arcade.draw_arc_outline(smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4)
def on_draw(self): #on draw function """ Draw the face """ arcade.start_render() #begins the render, needed face_x, face_y = (self.x, self.y ) #create 2 new variables to be used below smile_x, smile_y = ( face_x + 0, face_y - 10 ) #set the coordinates of the smile relative to the face eye1_x, eye1_y = ( face_x - 30, face_y + 20 ) #set the coordinates of the eye relative to the face eye2_x, eye2_y = ( face_x + 30, face_y + 20 ) #set the coordinates of the eye relative to the face catch1_x, catch1_y = ( face_x - 25, face_y + 25 ) #set the coordinates of the eye catch relative to the face catch2_x, catch2_y = ( face_x + 35, face_y + 25 ) #set the coordinates of the eye catch relative to the face arcade.draw_circle_filled(face_x, face_y, 100, open_color.yellow_3) #draw in certain color arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) #draw in certain color arcade.draw_ellipse_filled(eye1_x, eye1_y, 15, 25, open_color.black) #draw in certain color arcade.draw_ellipse_filled(eye2_x, eye2_y, 15, 25, open_color.black) #draw in certain color arcade.draw_circle_filled(catch1_x, catch1_y, 3, open_color.gray_2) #draw in certain color arcade.draw_circle_filled(catch2_x, catch2_y, 3, open_color.gray_2) #draw in certain color arcade.draw_arc_outline(smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4) #draw in certain color
def on_draw(self): #command that draws the face """ Draw the face """ arcade.start_render() #nothing renders without this face_x, face_y = (self.x, self.y) smile_x, smile_y = (face_x + 0, face_y - 10 ) #Draws the coordinates of the smile eye1_x, eye1_y = (face_x - 30, face_y + 20 ) #These are the coordinates of the left eye eye2_x, eye2_y = (face_x + 30, face_y + 20 ) #These are the coordinates of the right eye catch1_x, catch1_y = (face_x - 25, face_y + 25 ) #draws the dimensions in the left eye catch2_x, catch2_y = (face_x + 35, face_y + 25 ) #draws the dimensions in the right eye arcade.draw_circle_filled( face_x, face_y, 100, open_color.yellow_3 ) #Draws the yellow filled portion of the smiley arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) #draws tne outline of the smiley face arcade.draw_ellipse_filled(eye1_x, eye1_y, 15, 25, open_color.black) #draws the left eye arcade.draw_ellipse_filled(eye2_x, eye2_y, 15, 25, open_color.black) #draws the right eye arcade.draw_circle_filled( catch1_x, catch1_y, 3, open_color.gray_2) #Draws the gray dot in the eye arcade.draw_circle_filled( catch2_x, catch2_y, 3, open_color.gray_2) #Draws the gray dot in the right eye arcade.draw_arc_outline(smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4) #Draws the smile
def draw(self): # arcade.draw_rectangle_filled(self.center.x - 100, self.center.y, 25, 16, arcade.color.ALABAMA_CRIMSON) arcade.draw_arc_outline(self.center.x - 20, self.center.y, 25, 16, arcade.color.TANGO_PINK, 60, 130) # arcade.draw_arc_outline(self.center.x + 40, self.center.y, 25, 16, arcade.color.CADMIUM_ORANGE, 90, 180) arcade.draw_circle_filled(self.center.x, self.center.y, 12, arcade.color.AQUA)
def on_draw(self): arcade.start_render() if self.seed.tutorial: arcade.draw_text(self.seed.tutorial, self.platforms[-1].center_x + 40, 100, arcade.color.WHITE, 30) if self.seed.lvl_id or self.seed.lvl_id == 0: arcade.draw_text(f'Level: {self.seed.lvl_id + 1}', self.view_left + C.SCREEN_WIDTH - 20, self.view_bottom + C.SCREEN_HEIGHT - 40, arcade.color.WHITE, 20, anchor_x='right') else: arcade.draw_text(f'Seed: {self.seed.seed}', self.view_left + C.SCREEN_WIDTH - 20, self.view_bottom + C.SCREEN_HEIGHT - 40, arcade.color.WHITE, 20, anchor_x='right') self.platforms.draw() self.player_sprite.draw() self.ennemies.draw() if self.hang_timer > 0 and self.space_pressed and len(self.primitive_list) > 0: self.primitive_list.draw() self.bullet_list.draw() if False is True: arcade.draw_arc_outline(800 + self.view_left, 450 + self.view_bottom, 300, 300, arcade.color.YELLOW, 0, 180, 15) arcade.draw_arc_outline(800 + self.view_left, 450 + self.view_bottom, 300, 300, arcade.color.BLUE, 180, 360, 15) fps = self.fps.get_fps() output = f"FPS: {fps:3.0f}" arcade.draw_text(output, 20 + self.view_left, C.SCREEN_HEIGHT + self.view_bottom - 40, arcade.color.WHITE, 16)
def draw_pizza(corner_x1, corner_y1): """ Drawing the pizza slice """ corner_x2 = corner_x1+1.28*PLATE_RADIUS corner_y2 = corner_y1-0.08*PLATE_RADIUS corner_x3 = corner_x1+0.8*PLATE_RADIUS corner_y3 = corner_y1-PLATE_RADIUS arcade.draw_triangle_filled(corner_x1, corner_y1, corner_x2, corner_y2, corner_x3, corner_y3, (235, 153, 38)) arcade.draw_triangle_outline(corner_x1, corner_y1, corner_x2, corner_y2, corner_x3, corner_y3, (0, 0, 0)) # Crust arcade.draw_arc_filled((corner_x2 + corner_x3)/2-1, (corner_y2 + corner_y3)/2, ((corner_x2-corner_x3)**2 + (corner_y2-corner_y3)**2)**0.5, PLATE_RADIUS*0.24, (201, 156, 58), 0, 180, 242.3) arcade.draw_arc_outline((corner_x2 + corner_x3)/2-1, (corner_y2 + corner_y3)/2, ((corner_x2-corner_x3)**2 + (corner_y2-corner_y3)**2)**0.5, PLATE_RADIUS*0.24, (0, 0, 0), 0, 180, 3, 242.3)
def draw_rocks(x, y): # middle rock arcade.draw_arc_outline(400 + x, 250 + y, 80, 60, arcade.color.COOL_BLACK, 0, 180) arcade.draw_arc_filled(400 + x, 250 + y, 80, 60, arcade.color.DARK_SLATE_GRAY, 0, 180) # right rock arcade.draw_arc_outline(450 + x, 270 + y, 50, 40, arcade.color.COOL_BLACK, 0, 180) arcade.draw_arc_filled(450 + x, 270 + y, 50, 40, arcade.color.DARK_SLATE_GRAY, 0, 180)
def draw_BB8(x, y, radius): #the white circle arcade.draw_circle_filled(x, y, radius, arcade.color.WHITE) arcade.draw_circle_outline(x, y, radius, arcade.color.BLACK, 1.5) #the orange circle arcade.draw_circle_filled(x, y, radius / 10 * 6.5, arcade.color.ORANGE) arcade.draw_circle_outline(x, y, radius / 10 * 6.5, arcade.color.BLACK, 1.5) #the blue circle arcade.draw_circle_filled(x, y, radius / 10 * 3.5, arcade.color.LIGHT_BLUE) arcade.draw_circle_outline(x, y, radius / 10 * 3.5, arcade.color.BLACK, 1.5) #ellipse circle arcade.draw_arc_filled(x + radius / 10 * 0.1, y + radius / 10 * 9.5, radius + 1, radius + 1, arcade.color.WHITE, 0, 180, 0) arcade.draw_arc_outline(x + radius / 10 * 0.1, y + radius / 10 * 9.5, radius, radius, arcade.color.BLACK, 0, 180, 2.5) arcade.draw_line(x - radius / 10 * 4.8, y + radius - 2, x + radius / 10 * 5, y + radius - 2, arcade.color.BLACK, 2) #circle arcade.draw_circle_filled(x, y + radius / 10 * 12, radius / 10 * 1.5, arcade.color.BLUE_GRAY) arcade.draw_circle_outline(x, y + radius / 10 * 12, radius / 10 * 1.5, arcade.color.BLACK, 2)
def draw(self): x = 300 y = 300 radius = 200 arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW) # Draw the right eye x = 370 y = 350 radius = 20 arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK) # Draw the left eye x = 230 y = 350 radius = 20 arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK) # Draw the smile x = 300 y = 280 width = 120 height = 100 start_angle = 190 end_angle = 350 arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle, end_angle, 10) super().draw()
def draw_island(x, y): """Function to draw an island with a nice tree on it in a specific location""" arcade.draw_arc_filled(x, y, 100, 100, arcade.color.SAND, 0, 180) arcade.draw_arc_outline(x - 20, y + 40, 20, 70, arcade.color.BROWN, 0, 100, 20) arcade.draw_triangle_filled(x - 30, y + 55, x - 40, y + 65, x - 15, y + 85, arcade.color.GREEN) arcade.draw_triangle_filled(x - 35, y + 100, x - 40, y + 85, x - 15, y + 80, arcade.color.GREEN) arcade.draw_triangle_filled(x + 15, y + 100, x - 20, y + 80, x, y + 80, arcade.color.GREEN)
def Draw_Smile(x=300, y=280): width = 120 height = 100 start_angle = 190 end_angle = 350 arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK, start_angle, end_angle, 10)
def on_draw(self): # Place the image on the cursor """ Draw the face """ arcade.start_render() # Start the rendering of the face face_x, face_y = (self.x, self.y ) # Face and self are the same coordinates smile_x, smile_y = ( face_x + 0, face_y - 10 ) # Smile coordinates are equal to shifted face coordinates eye1_x, eye1_y = ( face_x - 30, face_y + 20 ) # Eye 1 coordinates are equal to shifted face coordinates eye2_x, eye2_y = ( face_x + 30, face_y + 20 ) # Eye 2 coordinates are equal to shifted face coordinates catch1_x, catch1_y = ( face_x - 25, face_y + 25 ) # Pupil 1 coordinates are equal to shifted face coordinates catch2_x, catch2_y = ( face_x + 35, face_y + 25 ) # Pupil 2 coordinates are equal to shifted face coordinates arcade.draw_circle_filled( face_x, face_y, 100, open_color.yellow_3 ) # Lines 37 -43 are the creation of the parts of the face arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) arcade.draw_ellipse_filled(eye1_x, eye1_y, 15, 25, open_color.black) arcade.draw_ellipse_filled(eye2_x, eye2_y, 15, 25, open_color.black) arcade.draw_circle_filled(catch1_x, catch1_y, 3, open_color.gray_2) arcade.draw_circle_filled(catch2_x, catch2_y, 3, open_color.gray_2) arcade.draw_arc_outline(smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4)
def circle_arc_outline(center_x: float, center_y: float, radius: float, color, start_angle: float, end_angle: float, border_width: float = 1, tilt_angle: float = 0, num_segments: int = 128): """ Draw the outside edge of a circular arc. Useful for drawing curved lines. Good for saving space by cutting out a parameter. :param center_x: x position that is the center of the arc. :param center_y: y position that is the center of the arc. :param radius: radius of the arc. :param color: color, specified in a list of 3 or 4 bytes in RGB or RGBA format. :param start_angle: start angle of the arc in degrees. :param end_angle: end angle of the arc in degrees. :param border_width: width of line in pixels. :param tilt_angle: angle the arc is tilted. :param num_segments: float of triangle segments that make up this circle. Higher is better quality, but slower render time. """ arcade.draw_arc_outline(center_x, center_y, radius * 2, radius * 2, color, start_angle, end_angle, border_width, tilt_angle, num_segments)
def on_draw(self): # define on_draw """ Draw the face """ arcade.start_render( ) # start the render process. This must be done before any drawing commands face_x, face_y = (self.x, self.y) smile_x, smile_y = (face_x + 0, face_y - 10 ) #set the position of smile eye1_x, eye1_y = (face_x - 30, face_y + 20) #set the position of eye1 eye2_x, eye2_y = (face_x + 30, face_y + 20) #set the position of eye2 catch1_x, catch1_y = (face_x - 25, face_y + 25 ) #set the position of catch1 catch2_x, catch2_y = (face_x + 35, face_y + 25 ) #set the position of catch2 arcade.draw_circle_filled( face_x, face_y, 100, open_color.yellow_3) #fill the circle with yellow arcade.draw_circle_outline(face_x, face_y, 100, open_color.black, 4) #draw the outline of circle with black arcade.draw_ellipse_filled(eye1_x, eye1_y, 15, 25, open_color.black) #fill the eye1 with black arcade.draw_ellipse_filled(eye2_x, eye2_y, 15, 25, open_color.black) #fill the eye2 with black arcade.draw_circle_filled( catch1_x, catch1_y, 3, open_color.gray_2) #fill the catch1 with grey arcade.draw_circle_filled( catch2_x, catch2_y, 3, open_color.gray_2) #fill the catch2 with grey arcade.draw_arc_outline(smile_x, smile_y, 60, 50, open_color.black, 190, 350, 4) #draw the smile arc with black
def on_draw(self): """ Render the screen """ # This command has to happen before we start drawing arcade.start_render() self.grid_sprite_list.draw(filter=GL_NEAREST) self.block_list.draw(filter=GL_NEAREST) #drawing player self.player_list.draw(filter=GL_NEAREST) self.sfx_list.draw() self.chrome_tiles.draw(filter=GL_NEAREST) # Print scores on the screen d_height = 20 current_text_height = self.height - d_height if not self.app_config.get('no_text', False): for pid, player in self.game.players.items(): name = "{}{}".format(player.name, '(bot)' if self.game.is_bot(pid) else "") player_output = f"{name} HP: {player.hp:3d} / Ammo: {player.ammo:3d} / Score: {player.reward:4d}" arcade.draw_text(player_output, 10, current_text_height, arcade.color.WHITE, 14, font_name='arial') current_text_height -= d_height if self.paused and not self.app_config.get('no_text', False): arcade.draw_text("PAUSED", self.width / 2, self.height / 2, arcade.color.WHITE, 42, bold=True, font_name='arial', align="center", anchor_x="center", anchor_y="center") if self.game.is_over and self.end_game_wait_time: progress = 360 * (1 - self.end_game_timer / self.end_game_wait_time) sq_size = self.height / 4 width = sq_size / 4 arcade.draw_arc_outline(center_x=self.width / 2, center_y=self.height / 2, width=sq_size, height=sq_size, color=arcade.color.CYAN, border_width=width, start_angle=0, end_angle=progress, tilt_angle=90)
def boca(): x = 300 y = 280 largura = 120 altura = 100 inicio_angulo = 190 final_angulo = 350 arcade.draw_arc_outline(x, y, largura, altura, arcade.color.BLACK, inicio_angulo, final_angulo, 10) arcade.finish_render() arcade.run()
class Smiley(arcade.Window): # Make head of smiley x = 300 y = 300 radius = 200 arcade.draw_circle_filled(x, y, radius, arcade.color.PURPLE) # Make left eye x = 225 y = 350 radius = 20 arcade.draw_circle_filled(x, y, radius, arcade.color.GREEN) # Make right eye x = 375 y = 350 radius = 20 arcade.draw_circle_filled(x, y, radius, arcade.color.GREEN) # Make left eyebrow x = 225 y = 300 width = 100 height = 120 arcade.draw_arc_outline(x, y, width, height, arcade.color.GREEN, start_angle=55, end_angle=130, border_width=20) # Make right eyebrow x = 375 y = 300 width = 100 height = 120 arcade.draw_arc_outline(x, y, width, height, arcade.color.GREEN, start_angle=55, end_angle=130, border_width=20) # Make smile x = 300 y = 225 width = 100 height = -50 arcade.draw_arc_outline(x, y, width, height, arcade.color.GREEN, start_angle=0, end_angle=180, border_width=5)
def draw_BB8(x,y, radius): arcade.draw_circle_filled(x,y,radius,arcade.color.WHITE) arcade.draw_circle_outline(x,y,radius,arcade.color.BLACK,2) arcade.draw_circle_filled(x,y,radius*0.70, arcade.color.ORANGE) arcade.draw_circle_outline(x, y, radius*.70, arcade.color.BLACK,2) arcade.draw_circle_filled(x,y,radius*0.40,arcade.color.BABY_BLUE) arcade.draw_circle_outline(x, y, radius*0.40, arcade.color.BLACK,2) arcade.draw_arc_filled(x,y+radius*0.8,radius*0.85,radius*0.8,arcade.color.WHITE,0,180) arcade.draw_arc_outline(x,y+radius*0.8,radius*0.85,radius*0.8,arcade.color.BLACK,0,180,2) arcade.draw_circle_filled(x,y+radius*1.1,radius*0.20,arcade.color.BLUE) arcade.draw_circle_outline(x,y+radius*1.1,radius*0.20,arcade.color.BLACK,2) arcade.draw_line(x+radius*-0.85,y+radius*0.8,x+radius*0.85,y+radius*0.8,arcade.color.BLACK,2)
def move(delta_time): global times global first global track times += 1 for each in movers: thick = 3 x = each[0] y = each[1] radius = each[2] if radius <= 20: thick = 2 if times > 25 and times < 150: if first: time.sleep(15) first = False arcade.draw_circle_filled(x, y, radius, arcade.color.WHEAT) # big circle body arcade.draw_circle_outline(x, y, radius, arcade.color.WHEAT, thick) # outline arcade.draw_circle_filled(x, y, radius * (2 / 3), arcade.color.WHEAT) # smaller circle in body arcade.draw_circle_outline(x, y, radius * (2 / 3), arcade.color.WHEAT, thick) # outline arcade.draw_circle_filled(x, y, (radius * (2 / 3)) / 2, arcade.color.WHEAT) # smallest circle in body arcade.draw_circle_outline(x, y, (radius * (2 / 3)) / 2, arcade.color.WHEAT, thick) # outline arcade.draw_arc_filled(x, y + radius - (radius * .16666667), radius * 1.5, radius * 1.5, arcade.color.WHEAT, 0, 180) arcade.draw_arc_outline(x, y + radius - (radius * .16666667), radius * 1.5, radius * 1.5, arcade.color.WHEAT, 0, 180, thick + 2) arcade.draw_line(x - radius * 1.5 / 2, y + radius * (5 / 6), x - radius * 1.5 * -1 / 2, y + radius * (5 / 6), arcade.color.WHEAT, thick) arcade.draw_circle_filled(x, y + radius + (radius * .1966667), radius / 4.5, arcade.color.WHEAT) arcade.draw_circle_outline(x, y + radius + (radius * .1966667), radius / 4.5, arcade.color.WHEAT, thick) each[0] = random.randint(50, 550) each[1] = random.randint(50, 550) each[2] = radius draw_BB8(each[0], each[1], radius) print("times:", times) if times >= 150 and times <= 200: # arcade.play_sound(arcade.load_sound("alarm.mp3")) draw_BB8(random.randint(50, 550), random.randint(50, 550), random.randint(10, 60), True) elif times > 200 and times <= 320: track += 1 if track == 20: print("track") arcade.stop_sound(arcade.load_sound("alarm.mp3")) arcade.play_sound(arcade.load_sound("alarm.mp3")) track = 0 for i in range(25): draw_BB8(random.randint(50, 550), random.randint(50, 550), random.randint(10, 60), True) elif times > 320: arcade.stop_sound(arcade.load_sound("alarm.mp3")) for i in range(60): draw_BB8(random.randint(50, 550), random.randint(50, 550), random.randint(times-200, times-100), True) print("big")
def ocean_rise(self): # access global var global ocean_level # redraw island & updated sea level island() # flood island for i in range(0, ocean_level): arcade.draw_arc_outline(300, 260 + i, 225, 55, arcade.color.TEAL, 180, 360, 2, 0, 20) # increase sea level ocean_level += 1
def draw_bird(x, y): """ Draw a bird using a couple arcs. """ arcade.draw_arc_outline(x, y, 20, 20, arcade.color.BLACK, 0, 90) arcade.draw_arc_outline(x + 40, y, 20, 20, arcade.color.BLACK, 90, 180)
# Draw an ellipse outline, and another one rotated arcade.draw_text("draw_ellipse_outline", 483, 207, arcade.color.WHITE, 10) arcade.draw_ellipse_outline(540, 273, 15, 36, arcade.color.AMBER, 3) arcade.draw_ellipse_outline(540, 336, 15, 36, arcade.color.BLACK_BEAN, 3, 45) # Draw a filled ellipse, and another one rotated arcade.draw_text("draw_ellipse_filled", 3, 3, arcade.color.WHITE, 10) arcade.draw_ellipse_filled(60, 81, 15, 36, arcade.color.AMBER) arcade.draw_ellipse_filled(60, 144, 15, 36, 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