From 7a648e6b72ad995296a297582a2d8e1bd0b57a0e Mon Sep 17 00:00:00 2001 From: 24_OskinEA <24_OskinEA@iux.local> Date: Wed, 18 Mar 2026 12:03:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20rabit2.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rabit2.py | 132 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 79 insertions(+), 53 deletions(-) diff --git a/rabit2.py b/rabit2.py index 21f1695..8203306 100755 --- a/rabit2.py +++ b/rabit2.py @@ -5,57 +5,83 @@ from pygame.draw import * pygame.init() FPS = 30 -screen = pygame.display.set_mode((400, 400)) +screen = pygame.display.set_mode((600, 600)) +clock = pygame.time.Clock() + +# ================= ORIGINAL FUNCTIONS ================= 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) + # пузико + circle(surface, (255, 255, 255), (x, body_y), body_width // 4) + + # голова head_size = height // 4 head_y = y - head_size // 2 draw_head(surface, x, head_y, 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) - # Глаза (белки) + # ПЕРЕДНИЕ лапы (перерисовал нормально — как овальные лапки снизу) + front_w = width // 8 + front_h = height // 10 + front_y = y + height // 5 + + # делаем их более «лежащими» и аккуратными + # сначала рисуем лапы + ellipse(surface, color, (x - width // 5 - front_w//2, front_y, front_w, front_h)) + ellipse(surface, color, (x + width // 5 - front_w//2, front_y, front_w, front_h)) + + # затем поверх — ТОЛЬКО розовые подушечки (полностью перекрывают центр) + circle(surface, (255, 220, 220), (x - width // 5, front_y + front_h//2), front_h//3) + circle(surface, (255, 220, 220), (x + width // 5, front_y + front_h//2), front_h//3) + + # небольшие "подушечки" (деталь) + circle(surface, (255, 220, 220), (x - width // 5, front_y + front_h//2), front_h//4) + circle(surface, (255, 220, 220), (x + width // 5, front_y + front_h//2), front_h//4) + + # хвостик + circle(surface, color, (x + body_width // 2, body_y), body_width // 8) + + # глаза eye_y = head_y - head_size // 8 eye_radius = head_size // 8 for eye_x in (x - head_size // 6, x + head_size // 6): circle(surface, (255, 255, 255), (eye_x, eye_y), eye_radius) + circle(surface, (0, 0, 0), (eye_x, eye_y), eye_radius // 2) - # Зрачки - pupil_radius = eye_radius // 2 - for pupil_x in (x - head_size // 6, x + head_size // 6): - circle(surface, (0, 0, 0), (pupil_x, eye_y), pupil_radius) - - # Блики в глазах - spark_radius = pupil_radius // 3 - for spark_x in (x - head_size // 6 - 2, x + head_size // 6 - 2): - circle(surface, (255, 255, 255), (spark_x, eye_y - 2), spark_radius) - - # Носик (розовый треугольник) + # нос nose_y = head_y + head_size // 8 polygon(surface, (255, 150, 150), [ (x, nose_y), @@ -63,55 +89,55 @@ def draw_hare(surface, x, y, width, height, color): (x + head_size // 8, nose_y + head_size // 12) ]) - # Ротик - line(surface, (150, 100, 100), - (x, nose_y + head_size // 16), - (x, nose_y + head_size // 8), 2) - # Немного румянца на щечках - blush_radius = head_size // 10 - for cheek_x in (x - head_size // 4, x + head_size // 4): - circle(surface, (255, 200, 200), (cheek_x, nose_y + head_size // 24), blush_radius) +# ================= EXTRA OBJECTS ================= - # Усики - whisker_y = nose_y + head_size // 24 - whisker_length = head_size // 4 - for i in range(3): - # Левые усики - line(surface, (100, 100, 100), - (x - head_size // 10, whisker_y + i * 2), - (x - whisker_length - head_size // 10, whisker_y - head_size // 10 + i * 2), 1) - # Правые усики - line(surface, (100, 100, 100), - (x + head_size // 10, whisker_y + i * 2), - (x + whisker_length + head_size // 10, whisker_y - head_size // 10 + i * 2), 1) - - # Передние лапки (две маленькие) - с обводкой - front_leg_width = width // 12 - front_leg_height = height // 8 - front_leg_y = y + height // 6 - - # Левая передняя лапка (с обводкой) - ellipse(surface, (0, 0, 0), (x - width // 6 - front_leg_width // 2, - front_leg_y - front_leg_height // 2, - front_leg_width, front_leg_height), 1) - - # Правая передняя лапка (с обводкой) - ellipse(surface, (0, 0, 0), (x + width // 6 - front_leg_width // 2, - front_leg_y - front_leg_height // 2, - front_leg_width, front_leg_height), 1) +def draw_sun(surface): + circle(surface, (255, 220, 0), (520, 80), 40) -draw_hare(screen, 200, 200, 200, 400, (200, 200, 200)) +def draw_cloud(surface, x, y): + circle(surface, (255, 255, 255), (x, y), 20) + circle(surface, (255, 255, 255), (x + 20, y), 25) + circle(surface, (255, 255, 255), (x + 40, y), 20) + + +def draw_house(surface): + rect(surface, (200, 150, 100), (50, 350, 120, 120)) + polygon(surface, (150, 75, 0), [(50, 350), (110, 300), (170, 350)]) + + +def draw_carrot(surface, x, y): + polygon(surface, (255, 120, 0), [(x, y), (x - 10, y + 30), (x + 10, y + 30)]) + line(surface, (0, 200, 0), (x, y), (x, y - 15), 3) + + +def draw_grass(surface): + for i in range(0, 600, 10): + line(surface, (0, 180, 0), (i, 580), (i + 5, 560), 2) + + +# ================= DRAW ================= +screen.fill((255, 255, 255)) + +draw_sun(screen) +draw_cloud(screen, 150, 80) +draw_cloud(screen, 250, 60) +draw_house(screen) +draw_carrot(screen, 450, 500) +draw_grass(screen) + +# один кролик +draw_hare(screen, 300, 300, 200, 400, (200, 200, 200)) pygame.display.update() -clock = pygame.time.Clock() -finished = False -while not finished: +# ================= LOOP ================= +running = True +while running: clock.tick(FPS) for event in pygame.event.get(): if event.type == pygame.QUIT: - finished = True + running = False pygame.quit()