Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import pygame
  2. import random
  3. SIZE=(640,480)
  4.  
  5. screen = pygame.display.set_mode(SIZE)
  6. pygame.display.set_caption("3laba.gra")
  7.  
  8. cycle = True
  9.  
  10. fon= pygame.Surface(SIZE)
  11. fon.fill((0,90,40))
  12.  
  13. fon1=pygame.Surface((32,32))
  14. fon1.fill((250,10,10))
  15.  
  16. x= random.randint(0,400)
  17. y= random.randint(0,250)
  18.  
  19. clock = pygame.time.Clock()
  20. while cycle:
  21. mpos= pygame.mouse.get_pos()
  22. for i in pygame.event.get():
  23. if i.type==pygame.QUIT:
  24. cycle=False
  25. break
  26.  
  27. if mpos[0] > x and mpos[0]< x+64 and mpos[1]> y and mpos[1] <y+32:
  28.  
  29. x=random.randint(0,600)
  30. y= random.randint(0,450)
  31. screen.blit(fon,(0,0))
  32. screen.blit(fon1,(x,y))
  33.  
  34. pygame.display.flip()
  35. clock.tick(60)
  36. print(clock.get_fps())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement