jabela

Whackamole Part 2

Dec 17th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. #Main Loop
  2. while running:
  3.     pos = pygame.mouse.get_pos()
  4.     (pressed1,pressed2,pressed3) = pygame.mouse.get_pressed()
  5.     if rectplace.collidepoint(pos)& pressed1==1:
  6.         print("Don't slap me!")
  7.         pygame.mixer.music.play(0)
  8.         counter=200000
  9.     if counter == 200000:
  10.         rectplace = pygame.draw.rect(window, (0, 0, 0),(randx, randy, 100, 100))
  11.         pygame.display.update()
  12.         randx = random.randrange(100, 500)
  13.         randy = random.randrange(100, 500)
  14.         rectplace = pygame.draw.rect(window, (255, 0, 0),(randx, randy, 100, 100))
  15.         counter=0
  16.         pygame.display.update()
  17.     counter=counter+1
  18.  
  19.     for event in pygame.event.get():
  20.         if event.type == pygame.QUIT:
  21.             running = False
Add Comment
Please, Sign In to add comment