Загрузить файлы в «/» #1

Open
24_ZhurovichAM wants to merge 1 commits from 24_ZhurovichAM/lab3:main into main
Showing only changes of commit 3d3201c6a8 - Show all commits

90
task1new.py Normal file
View File

@@ -0,0 +1,90 @@
import pygame
from pygame.draw import ellipse, circle
pygame.init()
FPS = 30
screen = pygame.display.set_mode((800, 600))
def draw_ear(surface, x, y, width, height, color):
ellipse(surface, color, (x, y, width, height))
def draw_head(surface, x, y, radius, color):
circle(surface, color, (x, y), radius)
def draw_eye(surface, x, y, radius, color):
circle(surface, color, (x, y), radius)
def draw_nose(surface, x, y, radius, color):
circle(surface, color, (x, y), radius)
def draw_body(surface, x, y, width, height, color):
ellipse(surface, color, (x, y, width, height))
def draw_leg(surface, x, y, width, height, color):
ellipse(surface, color, (x, y, width, height))
def draw_hare(surface, x, y, color):
draw_ear(surface, x + 350, y + 130, 30, 100, color)
draw_ear(surface, x + 420, y + 130, 30, 100, color)
draw_head(surface, x + 400, y + 250, 40, color)
draw_eye(surface, x + 385, y + 240, 5, (0, 0, 0))
draw_eye(surface, x + 415, y + 240, 5, (0, 0, 0))
draw_nose(surface, x + 400, y + 260, 5, (255, 0, 0))
draw_body(surface, x + 360, y + 280, 80, 120, color)
draw_body(surface, x + 355, y + 290, 25, 45, color)
draw_body(surface, x + 420, y + 290, 25, 45, color)
draw_leg(surface, x + 340, y + 360, 30, 50, color)
draw_leg(surface, x + 430, y + 360, 30, 50, color)
draw_hare(screen, 0, 0, (150, 150, 150))
pygame.display.flip()
clock = pygame.time.Clock()
finished = False
while not finished:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
finished = True
pygame.quit()