Files
YP_2026_litvintseva/draw2.py

83 lines
2.9 KiB
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
import pygame
from pygame.draw import *
pygame.init()
FPS = 30
screen = pygame.display.set_mode((800, 500))
def draw_landscape(screen):
# 1. Общий фон неба
screen.fill((255, 220, 180))
# 2. Солнце
circle(screen, (255, 240, 0), (450, 135), 55)
# 3. Светло-розовая полоса неба
rect(screen, (255, 205, 215), (0, 150, 800, 110))
# 4. ЗАДНИЙ ХРЕБЕТ (с мелкими деталями)
# Здесь добавлено больше "зубцов", чтобы форма была ломаной
back_mountain_points = [
(-50, 280), (10, 260), (100, 190), (180, 130), (230, 170),
(280, 210), (380, 230), (460, 205), (510, 215), (560, 140),
(650, 100), (710, 140), (780, 180), (850, 150), (850, 280)
]
polygon(screen, (245, 155, 65), back_mountain_points)
# 5. Светло-оранжевая полоса ("облака" под задним хребтом)
rect(screen, (255, 215, 160), (0, 260, 800, 45))
# 6. НИЖНИЙ ХРЕБЕТ (тёмно-оранжевый/коричневый)
# Делаем форму более рваной и агрессивной
middle_mountain_points = [
(-10, 420), (50, 310), (140, 430), (220, 300), (260, 350),
(310, 290), (400, 380), (450, 340), (530, 280), (620, 260),
(730, 360), (780, 290), (820, 350), (820, 420)
]
polygon(screen, (175, 75, 55), middle_mountain_points)
# 7. Вода (нижняя часть)
rect(screen, (165, 135, 150), (0, 420, 800, 80))
# 8. ПЕРЕДНИЙ ПЛАН (самые тёмные скалы)
dark_color = (45, 25, 45)
# Левая скала с изломами
left_cliff = [(-10, 330), (20, 340), (110, 370), (160, 450), (210, 510), (-10, 510)]
polygon(screen, dark_color, left_cliff)
# Правая скала с изломами
right_cliff = [(810, 380), (750, 420), (690, 470), (730, 510), (810, 510)]
polygon(screen, dark_color, right_cliff)
# 9. Птицы (в форме галочек V)
def draw_bird(x, y, size):
# Рисуем две линии для каждого крыла
lines(screen, (50, 30, 20), False, [(x, y), (x + size//2, y + size//4), (x + size, y - size//4)], 3)
# Группа птиц в центре
birds = [(350, 215, 18), (440, 230, 16), (460, 260, 14), (370, 280, 20)]
for b in birds:
draw_bird(b[0], b[1], b[2])
# Птицы на воде (отражения)
draw_bird(580, 430, 15)
draw_bird(650, 460, 12)
# Основной цикл
draw_landscape(screen)
pygame.display.update()
finished = False
clock = pygame.time.Clock()
while not finished:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
finished = True
pygame.quit()