Professional Documents
Culture Documents
import pygame
import sys
# Initialize Pygame
pygame.init()
screen = pygame.display.set_mode(window_size)
pygame.display.set_caption("Simple Game")
player_size = 50
clock = pygame.time.Clock()
while True:
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
# Update the game logic here (e.g., move the player)
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
player_pos[0] -= 5
if keys[pygame.K_RIGHT]:
player_pos[0] += 5
if keys[pygame.K_UP]:
player_pos[1] -= 5
if keys[pygame.K_DOWN]:
player_pos[1] += 5
pygame.display.flip()