Created
July 10, 2019 15:17
-
-
Save aziis98/96ebf15a4e0d474c65554bff9ae23928 to your computer and use it in GitHub Desktop.
A boilerplate script for the pygame library
This file contains hidden or 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 = 720 | |
| HEIGHT = 480 | |
| FPS = 30 | |
| WHITE = (255, 255, 255) | |
| BLACK = (0, 0, 0) | |
| RED = (255, 0, 0) | |
| GREEN = (0, 255, 0) | |
| BLUE = (0, 0, 255) | |
| pygame.init() | |
| screen = pygame.display.set_mode((WIDTH, HEIGHT)) | |
| pygame.display.set_caption("Lights & Shadows") | |
| clock = pygame.time.Clock() | |
| running = True | |
| while running: | |
| clock.tick(FPS) | |
| for event in pygame.event.get(): | |
| if event.type == pygame.QUIT: | |
| running = False | |
| screen.fill(BLUE) | |
| pygame.draw.rect(screen, RED, [WIDTH / 2 - 200, HEIGHT / 2 - 200, 200, 200], 2) | |
| pygame.draw.rect(screen, GREEN, [WIDTH / 2, HEIGHT / 2 - 50, 200, 150]) | |
| pygame.display.flip() | |
| pygame.quit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment