Skip to content

ЛР4 - Капник до доработки #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 197 additions & 0 deletions lb4/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
import pygame
from pygame.draw import *

pygame.init()

WHIDTH, HEIGHT = 600, 600
screen = pygame.display.set_mode((WHIDTH, HEIGHT))
pygame.display.set_caption("Капник Робот-Заяц") #MARK: Надпись (заметки для 3 варианта)

#MARK: Цвета которые нужны, мб нет, т к взял с прошлой лабы цвета
BLACK = (0, 0, 0)
YELLOW = (255, 255, 0)
RED = (255, 0, 0)
WHITE = (255, 255, 255)
GRAY = (100, 100, 100)
FONE = (255, 222, 173)
DARKORANGE = (255, 160, 0)
DARKRED = (139, 0, 0)
PERPLE = (255, 192, 203)
FIOL = (106, 90, 205)
ROSYBROWN = (188, 143, 143)
LIGHT_GRAY = (128, 128, 128)
GREEN = (0, 255, 0)

def drawRabbit():
screen.fill(WHITE) #MARK: Фон белого цвета

#MARK: Нарисовано туловище
pygame.draw.polygon(screen, GRAY, [
(WHIDTH//2 - 90, HEIGHT//2),
(WHIDTH//2 - 90, HEIGHT//2 + 200),
(WHIDTH//2 + 90, HEIGHT//2 + 200),
(WHIDTH//2 + 90, HEIGHT//2)
])

#MARK: Нарисован ремень на туловище
pygame.draw.polygon(screen, LIGHT_GRAY, [
(WHIDTH//2 - 90, HEIGHT//2 + 200),
(WHIDTH//2 - 90, HEIGHT//2 + 180),
(WHIDTH//2 + 90, HEIGHT//2 + 180),
(WHIDTH//2 + 90, HEIGHT//2 + 200)
])
#MARK: Нарисована бляшка на ремне

pygame.draw.polygon(screen, BLACK, [
(WHIDTH//2 - 10, HEIGHT//2 + 200),
(WHIDTH//2 - 10, HEIGHT//2 + 180),
(WHIDTH//2 + 10, HEIGHT//2 + 180),
(WHIDTH//2 + 10, HEIGHT//2 + 200)
])

#MARK: Нарисована голова

pygame.draw.polygon(screen, LIGHT_GRAY, [
(WHIDTH//2 - 70, HEIGHT//2),
(WHIDTH//2 - 70, HEIGHT//2 - 100),
(WHIDTH//2 + 70, HEIGHT//2 - 100),
(WHIDTH//2 + 70, HEIGHT//2)
])

#MARK: Нарисована морда

pygame.draw.polygon(screen, GRAY, [
(WHIDTH//2 - 20, HEIGHT//2 - 10),
(WHIDTH//2 - 20, HEIGHT//2 - 30),
(WHIDTH//2 + 20, HEIGHT//2 - 30),
(WHIDTH//2 + 20, HEIGHT//2 - 10)
])

#MARK: Нарисован нос

pygame.draw.polygon(screen, BLACK, [
(WHIDTH//2 - 5, HEIGHT//2 - 20),
(WHIDTH//2 - 5, HEIGHT//2 - 30),
(WHIDTH//2 + 5, HEIGHT//2 - 30),
(WHIDTH//2 + 5, HEIGHT//2 - 20)
])

#MARK: Нарисованы губы

pygame.draw.polygon(screen, BLACK, [
(WHIDTH//2 - 20, HEIGHT//2 - 10),
(WHIDTH//2, HEIGHT//2-10),
(WHIDTH//2, HEIGHT//2-20),
(WHIDTH//2, HEIGHT//2-10),
(WHIDTH//2 + 20, HEIGHT//2 - 10)
])

pygame.draw.line(screen, BLACK, (WHIDTH//2 - 20, HEIGHT//2 - 10), (WHIDTH//2 + 20, HEIGHT//2 - 10), 2)

#MARK: Нарисованы глаза

#MARK: Левый глаз
pygame.draw.circle(screen, GREEN, (WHIDTH//2 - 35, HEIGHT//2 - 50), 20)
pygame.draw.circle(screen, BLACK, (WHIDTH//2 - 35, HEIGHT//2 - 50), 10)
pygame.draw.circle(screen, WHITE, (WHIDTH//2 - 35, HEIGHT//2 - 50), 5)

#MARK: Правый глаз
pygame.draw.circle(screen, GREEN, (WHIDTH//2 + 35, HEIGHT//2 - 50), 20)
pygame.draw.circle(screen, BLACK, (WHIDTH//2 + 35, HEIGHT//2 - 50), 10)
pygame.draw.circle(screen, WHITE, (WHIDTH//2 + 35, HEIGHT//2 - 50), 5)

#MARK: Рисуем уши
#MARK: Левое ухо
pygame.draw.polygon(screen, GRAY, [
(WHIDTH//2 - 70, HEIGHT//2 - 100),
(WHIDTH//2 - 140, HEIGHT//2 - 200),
(WHIDTH//2 - 100, HEIGHT//2 - 200),
(HEIGHT//2 - 30, HEIGHT//2 - 100)
])

#MARK: Правое ухо
pygame.draw.polygon(screen, GRAY, [
(WHIDTH//2 + 70, HEIGHT//2 - 100),
(WHIDTH//2 + 140, HEIGHT//2 - 200),
(WHIDTH//2 + 100, HEIGHT//2 - 200),
(HEIGHT//2 + 30, HEIGHT//2 - 100)
])

#MARK: Левая нога
pygame.draw.polygon(screen, GRAY, [
(WHIDTH//2 - 80, HEIGHT//2 + 200),
(WHIDTH//2 - 60, HEIGHT//2 + 200),
(WHIDTH//2 - 60, HEIGHT//2 + 270),
(WHIDTH//2 - 80, HEIGHT//2 + 270)
])

#MARK: Правая нога
pygame.draw.polygon(screen, GRAY, [
(WHIDTH//2 + 80, HEIGHT//2 + 200),
(WHIDTH//2 + 60, HEIGHT//2 + 200),
(WHIDTH//2 + 60, HEIGHT//2 + 270),
(WHIDTH//2 + 80, HEIGHT//2 + 270)
])

#MARK: Ботинок на левой ноге
pygame.draw.polygon(screen, BLACK, [
(WHIDTH//2 - 90, HEIGHT//2 + 270),
(WHIDTH//2 - 50, HEIGHT//2 + 270),
(WHIDTH//2 - 50, HEIGHT//2 + 280),
(WHIDTH//2 - 90, HEIGHT//2 + 280)
])

#MARK: Ботинок на правой ноге
pygame.draw.polygon(screen, BLACK, [
(WHIDTH//2 + 90, HEIGHT//2 + 270),
(WHIDTH//2 + 50, HEIGHT//2 + 270),
(WHIDTH//2 + 50, HEIGHT//2 + 280),
(WHIDTH//2 + 90, HEIGHT//2 + 280)
])

#MARK: Левая рука
pygame.draw.polygon(screen, LIGHT_GRAY, [
(WHIDTH//2 - 90, HEIGHT//2 + 10),
(WHIDTH//2 - 90, HEIGHT//2 + 140),
(WHIDTH//2 - 110, HEIGHT//2 + 140),
(WHIDTH//2 - 110, HEIGHT//2 + 10)
])

#MARK: Кисть левой руки
pygame.draw.polygon(screen, BLACK, [
(WHIDTH//2 - 90, HEIGHT//2 + 140),
(WHIDTH//2 - 110, HEIGHT//2 + 140),
(WHIDTH//2 - 100, HEIGHT//2 + 160),
(WHIDTH//2 - 90, HEIGHT//2 + 160)
])

#MARK: Правая рука
pygame.draw.polygon(screen, LIGHT_GRAY, [
(WHIDTH//2 + 90, HEIGHT//2 + 10),
(WHIDTH//2 + 90, HEIGHT//2 + 140),
(WHIDTH//2 + 110, HEIGHT//2 + 140),
(WHIDTH//2 + 110, HEIGHT//2 + 10)
])

#MARK: Кисть правой руки
pygame.draw.polygon(screen, BLACK, [
(WHIDTH//2 + 90, HEIGHT//2 + 140),
(WHIDTH//2 + 110, HEIGHT//2 + 140),
(WHIDTH//2 + 100, HEIGHT//2 + 160),
(WHIDTH//2 + 90, HEIGHT//2 + 160)
])

clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False

drawRabbit() # MARK: Функция рисующая зайца
pygame.display.flip()
clock.tick(30)

pygame.quit()