OtsoSilver

Untitled

Sep 18th, 2021
628
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pygame
  2. import random
  3.  
  4. #Настройки окна
  5. WIDTH = 500
  6. HEIGHT = 500
  7. FPS = 60
  8.  
  9. # Цвета
  10. YELLOW = (255, 255, 0)
  11. SKY = (133, 193, 233)
  12. GREEN = (46, 204, 113)
  13. WHITE = (255, 255, 255)
  14.  
  15. #Инициализация
  16. pygame.init()
  17. screen = pygame.display.set_mode((WIDTH,HEIGHT))
  18. clock = pygame.time.Clock()
  19.  
  20. bird_img = pygame.image.load('fpbs1.png').convert()
  21. bird_rect = bird_img.get_rect()
  22. bw = bird_rect.width
  23. bh = bird_rect.height
  24. bird  = pygame.Rect(40, 40, bw, bh)
  25. points = 0
  26. font = pygame.font.SysFont('comic sans ms', 30)
  27. game_over_font = pygame.font.SysFont('comic sans ms', 50)
  28. game_over_text = game_over_font.render('GAME OVER', 1, WHITE)
  29.  
  30.  
  31.  
  32. gravity_scale = 0.3
  33. bird_speed = 0
  34.  
  35.  
  36. running = True
  37. while running:
  38.     screen.fill(SKY)
  39.     for i in pygame.event.get():
  40.         if i.type == pygame.QUIT:
  41.             running = False
  42.    
  43.    
  44.     bird_speed += gravity_scale
  45.     bird.y += bird_speed
  46.     screen.blit(bird_img, (bird.left, bird.top))
  47.     clock.tick(FPS)
  48.     pygame.display.update()
  49. pygame.quit()
  50.  
  51.  
  52.  
  53.  
RAW Paste Data