forked from 24_MokanGV/LABAn3
Initial commit
This commit is contained in:
88
kroliklaba3.py
Normal file
88
kroliklaba3.py
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
import pygame
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Инициализация
|
||||||
|
pygame.init()
|
||||||
|
WIDTH, HEIGHT = 600, 600
|
||||||
|
screen = pygame.display.set_mode((WIDTH, HEIGHT))
|
||||||
|
pygame.display.set_caption("Кроликкк")
|
||||||
|
|
||||||
|
# Цвета
|
||||||
|
WHITE = (255, 255, 255)
|
||||||
|
GRAY = (200, 200, 200)
|
||||||
|
PINK = (255, 180, 180)
|
||||||
|
BLACK = (0, 0, 0)
|
||||||
|
|
||||||
|
|
||||||
|
def draw_ears(surface):
|
||||||
|
# Внешняя часть ушей
|
||||||
|
pygame.draw.ellipse(surface, GRAY, (250, 100, 40, 120))
|
||||||
|
pygame.draw.ellipse(surface, GRAY, (310, 100, 40, 120))
|
||||||
|
# Внутренняя часть ушей
|
||||||
|
pygame.draw.ellipse(surface, PINK, (260, 110, 20, 80))
|
||||||
|
pygame.draw.ellipse(surface, PINK, (320, 110, 20, 80))
|
||||||
|
|
||||||
|
|
||||||
|
def draw_head(surface):
|
||||||
|
pygame.draw.circle(surface, GRAY, (300, 250), 80)
|
||||||
|
|
||||||
|
|
||||||
|
def draw_face(surface):
|
||||||
|
# Глаза
|
||||||
|
pygame.draw.circle(surface, BLACK, (270, 240), 10)
|
||||||
|
pygame.draw.circle(surface, BLACK, (330, 240), 10)
|
||||||
|
# Блик в глазах
|
||||||
|
pygame.draw.circle(surface, WHITE, (275, 235), 4)
|
||||||
|
pygame.draw.circle(surface, WHITE, (335, 235), 4)
|
||||||
|
|
||||||
|
# Нос
|
||||||
|
pygame.draw.circle(surface, PINK, (300, 270), 8)
|
||||||
|
|
||||||
|
# Рот
|
||||||
|
pygame.draw.arc(surface, BLACK, (285, 275, 30, 20), 3.14, 0, 2)
|
||||||
|
|
||||||
|
# Усы
|
||||||
|
pygame.draw.line(surface, BLACK, (260, 270), (220, 265), 2)
|
||||||
|
pygame.draw.line(surface, BLACK, (260, 275), (220, 280), 2)
|
||||||
|
pygame.draw.line(surface, BLACK, (340, 270), (380, 265), 2)
|
||||||
|
pygame.draw.line(surface, BLACK, (340, 275), (380, 280), 2)
|
||||||
|
|
||||||
|
|
||||||
|
def draw_body(surface):
|
||||||
|
pygame.draw.ellipse(surface, GRAY, (240, 330, 120, 150))
|
||||||
|
|
||||||
|
|
||||||
|
def draw_limbs(surface):
|
||||||
|
# Лапки
|
||||||
|
pygame.draw.ellipse(surface, GRAY, (250, 450, 40, 50))
|
||||||
|
pygame.draw.ellipse(surface, GRAY, (310, 450, 40, 50))
|
||||||
|
# Хвост
|
||||||
|
pygame.draw.circle(surface, WHITE, (300, 470), 20)
|
||||||
|
|
||||||
|
|
||||||
|
def draw_rabbit(surface):
|
||||||
|
draw_ears(surface)
|
||||||
|
draw_head(surface)
|
||||||
|
draw_face(surface)
|
||||||
|
draw_body(surface)
|
||||||
|
draw_limbs(surface)
|
||||||
|
|
||||||
|
|
||||||
|
# Основной цикл
|
||||||
|
running = True
|
||||||
|
clock = pygame.time.Clock()
|
||||||
|
|
||||||
|
while running:
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
running = False
|
||||||
|
|
||||||
|
screen.fill(WHITE)
|
||||||
|
|
||||||
|
draw_rabbit(screen)
|
||||||
|
|
||||||
|
pygame.display.flip()
|
||||||
|
clock.tick(60)
|
||||||
|
|
||||||
|
pygame.quit()
|
||||||
|
sys.exit()
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
import pygame
|
|
||||||
import sys
|
|
||||||
|
|
||||||
pygame.init()
|
|
||||||
|
|
||||||
WIDTH, HEIGHT = 600, 600
|
|
||||||
screen = pygame.display.set_mode((WIDTH, HEIGHT))
|
|
||||||
pygame.display.set_caption("Кроликкк")
|
|
||||||
|
|
||||||
WHITE = (255, 255, 255)
|
|
||||||
GRAY = (200, 200, 200)
|
|
||||||
PINK = (255, 180, 180)
|
|
||||||
BLACK = (0, 0, 0)
|
|
||||||
BLUE = (100, 150, 255)
|
|
||||||
|
|
||||||
running = True
|
|
||||||
clock = pygame.time.Clock()
|
|
||||||
|
|
||||||
while running:
|
|
||||||
for event in pygame.event.get():
|
|
||||||
if event.type == pygame.QUIT:
|
|
||||||
running = False
|
|
||||||
|
|
||||||
screen.fill(WHITE)
|
|
||||||
|
|
||||||
pygame.draw.ellipse(screen, GRAY, (250, 100, 40, 120))
|
|
||||||
pygame.draw.ellipse(screen, GRAY, (310, 100, 40, 120))
|
|
||||||
pygame.draw.ellipse(screen, PINK, (260, 110, 20, 80))
|
|
||||||
pygame.draw.ellipse(screen, PINK, (320, 110, 20, 80))
|
|
||||||
|
|
||||||
pygame.draw.circle(screen, GRAY, (300, 250), 80)
|
|
||||||
|
|
||||||
pygame.draw.circle(screen, BLACK, (270, 240), 10)
|
|
||||||
pygame.draw.circle(screen, BLACK, (330, 240), 10)
|
|
||||||
pygame.draw.circle(screen, WHITE, (275, 235), 4)
|
|
||||||
pygame.draw.circle(screen, WHITE, (335, 235), 4)
|
|
||||||
|
|
||||||
pygame.draw.circle(screen, PINK, (300, 270), 8)
|
|
||||||
|
|
||||||
pygame.draw.arc(screen, BLACK, (285, 275, 30, 20), 3.14, 0, 2)
|
|
||||||
|
|
||||||
pygame.draw.line(screen, BLACK, (260, 270), (220, 265), 2)
|
|
||||||
pygame.draw.line(screen, BLACK, (260, 275), (220, 280), 2)
|
|
||||||
pygame.draw.line(screen, BLACK, (340, 270), (380, 265), 2)
|
|
||||||
pygame.draw.line(screen, BLACK, (340, 275), (380, 280), 2)
|
|
||||||
|
|
||||||
pygame.draw.ellipse(screen, GRAY, (240, 330, 120, 150))
|
|
||||||
|
|
||||||
pygame.draw.ellipse(screen, GRAY, (250, 450, 40, 50))
|
|
||||||
pygame.draw.ellipse(screen, GRAY, (310, 450, 40, 50))
|
|
||||||
|
|
||||||
pygame.draw.circle(screen, WHITE, (300, 470), 20)
|
|
||||||
|
|
||||||
pygame.display.flip()
|
|
||||||
clock.tick(60)
|
|
||||||
|
|
||||||
pygame.quit()
|
|
||||||
sys.exit()
|
|
||||||
Reference in New Issue
Block a user