Advertisement
cookertron

Kostik Iln Revolving Crosshair

Feb 21st, 2022
1,132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. import pygame
  2. from pygame import Vector2, Rect
  3. from pygame.locals import *
  4.  
  5. WHITE = 16777215
  6. BLACK = 0
  7.  
  8. pygame.init()
  9. PDR = Rect(0, 0, 1280, 720)
  10. PDS = pygame.display.set_mode(PDR.size)
  11.  
  12. degrees = 0
  13. radius = 150
  14.  
  15. exit_demo = False
  16. while not exit_demo:
  17.     for e in pygame.event.get():
  18.         if e.type == KEYUP and e.key == K_ESCAPE:
  19.             exit_demo = False
  20.  
  21.     mp = pygame.mouse.get_pos()
  22.     crosshair_pos = Vector2(mp) + Vector2(1, 0).rotate(degrees) * radius
  23.     degrees += 1
  24.  
  25.     PDS.fill(BLACK)    
  26.     pygame.draw.line(PDS, WHITE, crosshair_pos - (0, 25), crosshair_pos + (0, 25))
  27.     pygame.draw.line(PDS, WHITE, crosshair_pos - (25, 0), crosshair_pos + (25, 0))
  28.     pygame.display.update()
  29.    
  30.     pygame.time.Clock().tick(120)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement