ayansiddiqui007 / Hacktoberfest-2023

Hacktoberfest 2023 Repository: Your Gateway to Open Source Welcome to the Hacktoberfest 2023 repository, where the world of open source coding awaits your contributions!
MIT License
0 stars 8 forks source link

Create game3.py #10

Closed masteriron-megasword closed 11 months ago

masteriron-megasword commented 11 months ago

Import the pygame module

import pygame

Import pygame.locals for easier access to key coordinates

Updated to conform to flake8 and black standards

from pygame.locals import ( K_UP, K_DOWN, K_LEFT, K_RIGHT, K_ESCAPE, KEYDOWN, QUIT, )

Initialize pygame

pygame.init()

Define constants for the screen width and height

SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600

Create the screen object

The size is determined by the constant SCREEN_WIDTH and SCREEN_HEIGHT

screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

3