Advertisement
snowden_web

Untitled

Dec 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. import pygame
  2.  
  3. #Константы
  4. WIDTH = 800
  5. HEIGHT = 600
  6. FPS = 60
  7. BLACK = (0,0,0)
  8.  
  9. #Создаем игру и окно
  10. pygame.init()
  11. screen = pygame.display.set_mode((WIDTH,HEIGHT))
  12. pygame.display.set_caption("Battle City")
  13. clock = pygame.time.Clock()
  14.  
  15. #Цикл игры
  16. running = True
  17. while running:
  18.     #Держим скорость цикла (контролируем ФПС)
  19.     clock.tick(FPS)
  20.    
  21.     #Ввод (захват) события
  22.     for event in pygame.event.get():
  23.         #Если нажали на крестик, закрываем игру
  24.         if event.type == pygame.QUIT:
  25.             running = False
  26.    
  27.     #Обновление игровых объектов
  28.    
  29.     #Рендеринг
  30.     screen.fill(BLACK)
  31.    
  32.     #После отрисовки всех объектов показываем игроку игровое поле
  33.     pygame.display.flip()
  34.  
  35. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement