pygame loop template

Solutions on MaxInterview for pygame loop template by the best coders in the world

showing results for - "pygame loop template"
Frieda
23 May 2018
1import sys
2 
3import pygame
4from pygame.locals import *
5 
6pygame.init()
7 
8fps = 60
9fpsClock = pygame.time.Clock()
10 
11width, height = 640, 480
12screen = pygame.display.set_mode((width, height))
13 
14# Game loop.
15while True:
16  screen.fill((0, 0, 0))
17  
18  for event in pygame.event.get():
19    if event.type == QUIT:
20      pygame.quit()
21      sys.exit()
22  
23  # Update.
24  
25  # Draw.
26  
27  pygame.display.flip()
28  fpsClock.tick(fps)
queries leading to this page
pygame looppygame loop template