Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- import random
- SIZE=(640,480)
- screen = pygame.display.set_mode(SIZE)
- pygame.display.set_caption("3laba.gra")
- cycle = True
- fon= pygame.Surface(SIZE)
- fon.fill((0,90,40))
- fon1=pygame.Surface((32,32))
- fon1.fill((250,10,10))
- x= random.randint(0,400)
- y= random.randint(0,250)
- clock = pygame.time.Clock()
- while cycle:
- mpos= pygame.mouse.get_pos()
- for i in pygame.event.get():
- if i.type==pygame.QUIT:
- cycle=False
- break
- if mpos[0] > x and mpos[0]< x+64 and mpos[1]> y and mpos[1] <y+32:
- x=random.randint(0,600)
- y= random.randint(0,450)
- screen.blit(fon,(0,0))
- screen.blit(fon1,(x,y))
- pygame.display.flip()
- clock.tick(60)
- print(clock.get_fps())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement