From debed3e7c3312da4a17e92955a2f9fc369d26e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Wed, 18 Mar 2026 13:00:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=B7=D0=B0=D1=8F=D1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task1.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/task1.py b/task1.py index 9cae2d7..65ab23d 100644 --- a/task1.py +++ b/task1.py @@ -6,7 +6,45 @@ pygame.init() FPS = 30 screen = pygame.display.set_mode((400,400)) +WHITE = (255, 255, 255) +GRAY = (200, 200, 200) +BLACK = (0, 0, 0) +BROWN = (139, 69, 19) + #Рисунок +def draw_body(surface, x, y, width, height, color): + ''' Рисует тело ''' + ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) +def draw_head(surface, x, y, size, color): + ''' Рисует голову ''' + circle(surface, color, (x, y), size // 2) +def draw_ear(surface, x, y, width, height, color): + ''' Рисует ухо ''' + ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) +def draw_leg(surface, x, y, width, height, color): + ''' Рисует ногу ''' + ellipse(surface, color, (x - width // 2, y - height // 2, width, height)) +def draw_hare( surface, x, y, width, height, color): + ''' Рисует зайца ''' + body_width = width // 2 + body_height = height // 2 + body_y = y + body_height // 2 + draw_body(surface, x, body_y, body_width, body_height, color) + + head_size = height // 4 + draw_head(surface, x, y-head_size // 2, head_size, color) + + ear_height = height // 3 + ear_y = y - height // 2 + ear_height // 2 + for ear_x in (x-head_size // 4, x + head_size // 4): + draw_ear (surface, ear_x, ear_y, width // 8, ear_height, color) + + leg_height = height // 16 + leg_y =y + height // 2 - leg_height // 2 + for leg_x in (x - width // 4, x + width // 4): + draw_leg(surface, leg_x, leg_y, width // 4, leg_height, color) + +draw_hare(screen, 200, 200, 200, 400, BROWN) pygame.display.update() clock = pygame.time.Clock()