Advertisement
cookertron

Kostik Iln Circle Points

Mar 10th, 2022
1,108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import pygame
  2. from pygame.locals import *
  3. from pygame import Vector2
  4.  
  5. def get_points(num, pos, radius):
  6.     p = Vector2(pos)
  7.     v = Vector2(0, -1)
  8.     return [p + v.rotate(d) * radius for d in range(0, 360, 360 // num)]
  9.  
  10.  
  11. pygame.init()
  12. PDR = Rect(0, 0, 500, 500)
  13. PDS = pygame.display.set_mode(PDR.size)
  14.  
  15. points = get_points(4, PDR.center, 50)
  16.  
  17. exit_demo = False
  18. while not exit_demo:
  19.     for e in pygame.event.get():
  20.         if e.type == KEYUP and e.key == K_ESCAPE:
  21.             exit_demo = True
  22.    
  23.     PDS.fill(0)
  24.  
  25.     for i, p in enumerate(points):
  26.         if i == 0:
  27.             pygame.draw.circle(PDS, 0xFFFFFF, p, 5)
  28.         else:
  29.             pygame.draw.circle(PDS, 0xFF0000, p, 5)
  30.    
  31.     pygame.display.update()
  32.  
  33. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement