Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- def nc(b):
- a = [WIN_WIDTH//2, WIN_HEIGHT//2]
- return([a[0]+b[0]*50,a[1]-b[1]*50])
- FPS = 60
- WIN_WIDTH = 1000
- WIN_HEIGHT = 800
- WHITE = (255, 255, 255)
- BLACK = (0, 0, 0)
- GRAY = (125, 125, 125)
- LIGHT_BLUE = (64, 128, 255)
- GREEN = (0, 200, 64)
- YELLOW = (225, 225, 0)
- PINK = (230, 50, 230)
- pygame.init()
- clock = pygame.time.Clock()
- sc = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT))
- center = [WIN_WIDTH//2, WIN_HEIGHT//2]
- dom = [[1,1],[3,1],[3,3],[2,4],[1,3]]
- #pov = [1/2**0.5, 1/2**0.5]
- #centr_pov = [2,2]
- #for y in dom:
- # x = [y[0]-centr[0], y[1]-centr[1]]
- # print(x[0]*pov[0] - x[1]*pov[1] + centr_pov[0], x[0]*pov[1] + x[1]*pov[0]+centr_pov[1])
- #Замена координат дома
- for i in range(len(dom)):
- dom[i] = nc(dom[i])
- points = []
- for i in range(0, WIN_WIDTH+1,50):
- points.append([i,WIN_HEIGHT//2])
- for i in range(0,WIN_HEIGHT+1,50):
- points.append([WIN_WIDTH//2,i])
- while 1:
- sc.fill(WHITE)
- for i in pygame.event.get():
- if i.type == pygame.QUIT: exit()
- #Вот здесь всё рисуем
- #ось х
- pygame.draw.aaline(sc, BLACK, nc([-WIN_WIDTH//2, 0]), nc([WIN_WIDTH//2, 0]))
- #ось у
- pygame.draw.aaline(sc, BLACK, nc([0, -WIN_HEIGHT//2]), nc([0, WIN_HEIGHT//2]))
- #точки на осях
- for point in points:
- pygame.draw.circle(sc, BLACK, point, 3)
- #центр (0,0)
- pygame.draw.circle(sc, BLACK, nc([0, 0]), 5)
- #Дом!
- pygame.draw.polygon(sc, YELLOW, dom)
- #до сюда
- pygame.display.update()
- pygame.time.delay(1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement