Last active
August 11, 2021 16:35
-
-
Save cbscribe/9ce2e6cd40be079a0257e9fc1650d2e7 to your computer and use it in GitHub Desktop.
Pygame template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import random | |
WIDTH = 800 | |
HEIGHT = 600 | |
FPS = 60 | |
pygame.init() | |
screen = pygame.display.set_mode((WIDTH, HEIGHT)) | |
clock = pygame.time.Clock() | |
all_sprites = pygame.sprite.Group() | |
running = True | |
while running: | |
clock.tick(FPS) | |
# events | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: | |
running = False | |
# updates | |
all_sprites.update() | |
# draw | |
screen.fill( (40, 40, 40) ) | |
all_sprites.draw(screen) | |
pygame.display.flip() # DO THIS LAST! | |
pygame.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment