diff --git a/task3.py b/task3.py new file mode 100644 index 0000000..58faf8f --- /dev/null +++ b/task3.py @@ -0,0 +1,71 @@ +import pygame +from pygame.draw import * + +pygame.init() + +FPS = 30 +screen = pygame.display.set_mode((2000, 1000)) +a = 30 +dx = 80 +y = 450 + +rect(screen, (100, 100, 100), (0, 0, 2000, 450)) +rect(screen, (10, 10, 10), (0, 450, 1000, 2000)) + + +circle(screen, (200, 200, 200), (875, 100), 75) +ellipse(screen, (40, 40, 40), (40, 100, 800, 75)) +ellipse(screen, (60, 60, 60), (450, 60, 570, 75)) +ellipse(screen, (50, 50, 50), (600, 160, 570, 60)) + +def house(x, y): + rect(screen, (40, 30, 20), (30+x, 250+y, 550, 500)) + rect(screen, (30, 30, 30), (390+x, 150+y, 20, 75)) + polygon(screen, (20, 20, 20), [(0+x, 250+y), (60+x, 200+y), (550+x, 200+y), (610+x, 250+y)]) + rect(screen, (30, 30, 30), (120+x, 150+y, 20, 75)) + rect(screen, (30, 30, 30), (450+x, 150+y, 20, 75)) + rect(screen, (30, 30, 30), (150+x, 100+y, 40, 125)) + + + rect(screen, (60, 50, 50), (70+x, 250+y, 75, 200)) + rect(screen, (60, 50, 50), (200+x, 250+y, 75, 200)) + rect(screen, (60, 50, 50), (330+x, 250+y, 75, 200)) + rect(screen, (60, 50, 50), (470+x, 250+y, 75, 200)) + + + rect(screen, (60, 30, 30), (100+x, 600+y, 100, 75)) + rect(screen, (60, 30, 30), (250+x, 600+y, 100, 75)) + rect(screen, (200, 200, 30), (400+x, 600+y, 100, 75)) + + + rect(screen, (20, 20, 20), (0+x, 450+y, 620, 40)) + for i in range(16): + rect(screen, (20, 20, 20), (40*i+x, 400+y, 20, 50)) + rect(screen, (20, 20, 20), (20+x, 380+y, 580, 20)) + +house(0, 0) +house(800, 100) +house(1600, -200) + +def prizrak(x, y): + circle(screen, (200, 200, 200), (800+x, 700+y), 40) + polygon(screen, (200, 200, 200), [(840+x, 700+y), (845+x, 707+y), (847+x, 715+y), (865+x, 735+y), (875+x, 752+y), (880+x, 765+y), (900+x, 775+y), (907+x, 780+y), (904+x, 786+y), (897+x, 790+y), (880+x, 800+y), (870+x, 797+y), (860+x, 797+y), (855+x, 804+y), (850+x, 810+y), (840+x, 810+y), (830+x, 805+y), (810+x, 810+y), (795+x, 830+y), (780+x, 830+y), (760+x, 820+y), (750+x, 780+y), (760+x, 760+y), (760+x, 700+y)]) + circle(screen, (255, 0, 0, 20), (780+x, 685+y), 4) + circle(screen, (255, 0, 0, 20), (800+x, 690+y), 4) + + +prizrak(0, 0) +prizrak(100, -20) +prizrak(-300, 20) + +pygame.display.update() +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()