Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import random
  2. import pygame
  3.  
  4. pygame.init()
  5. display = pygame.display.set_mode((400,300))
  6. clock = pygame.time.Clock()
  7.  
  8. colors = list(pygame.color.THECOLORS.values())
  9.  
  10. class Segment:
  11.  
  12. def __init__(self):
  13. self.original = pygame.Surface((100,100))
  14. for y in range(self.original.get_height()):
  15. for x in range(self.original.get_width()):
  16. self.original.set_at((x,y), random.choice(colors))
  17. self.count = 0
  18.  
  19. def update(self):
  20. self.image = pygame.transform.rotate(self.original, self.count)
  21. self.rect = self.image.get_rect(center=display.get_rect().center)
  22. self.count = (self.count + 1) % 360
  23.  
  24.  
  25. segment = Segment()
  26.  
  27. while not pygame.event.peek(pygame.QUIT):
  28. segment.update()
  29. display.fill((10,10,10))
  30. display.blit(segment.image, segment.rect)
  31. pygame.display.flip()
  32. clock.tick(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement