OtsoSilver

Untitled

Sep 18th, 2021
723
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. bh = bird_rect.height
  23. bw = bird_rect.width
  24.  
  25. bird = pygame.Rect(40,40, bw, bh)
  26. points = 0
  27.  
  28. font = pygame.font.SysFont('comic sans ms', 30)
  29. game_over_font = pygame.font.SysFont('comic sans ms', 50)
  30. game_over_text = game_over_font.render('GAME OVER', 1, WHITE)
  31. grav_scale = 0.3
  32. a_speed = 0
  33. is_jump = False
  34. running = True
  35. while running:
  36.     for i in pygame.event.get():
  37.         if i.type == pygame.QUIT:
  38.             running = False
  39.         if i.type == pygame.KEY_DOWN:
  40.             if i.key == pygame.K_SPACE:
  41.                 is_jump = True
  42.    
  43.    
  44.    
  45.     a_speed += grav_scale
  46.     bird.y += a_speed
  47.    
  48.     screen.fill(SKY)
  49.     screen.blit(bird_img, (bird.left, bird.top))
  50.     clock.tick(FPS)
  51.     pygame.display.update()
  52. pygame.quit()
RAW Paste Data