пишу пакмана на пайгейм и не знаю как сделать стены
import pygame
from settings import *
pygame.init()
display = pygame.display.set_mode((DISPLAY_WIDTH, DISPLAY_HEIGHT))
clock = pygame.time.Clock()
def game():
global PLAYER_SPEED_Y, PLAYER_SPEED_X, PLAYER_Y, PLAYER_X
running = True
while running:
# Контроль фпс
clock.tick(FPS)
# Обработка событийв
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
# Обновление
keys = pygame.key.get_pressed()
if keys[pygame.K_d]:
PLAYER_SPEED_X = 10
PLAYER_SPEED_Y = 0
if PLAYER_X >= (800 - PLAYER_WIDTH):
PLAYER_X = (800 - PLAYER_WIDTH)
if keys[pygame.K_a]:
PLAYER_SPEED_X = -10
PLAYER_SPEED_Y = 0
if PLAYER_X <= 0:
PLAYER_X = 0
if keys[pygame.K_s]:
PLAYER_SPEED_Y = 10
PLAYER_SPEED_X = 0
if PLAYER_Y >= (800 - PLAYER_HEIGHT):
PLAYER_Y = (800 - PLAYER_HEIGHT)
if keys[pygame.K_w]:
PLAYER_SPEED_Y = -10
PLAYER_SPEED_X = 0
if PLAYER_Y <= 0:
PLAYER_Y = 0
PLAYER_Y += PLAYER_SPEED_Y
PLAYER_X += PLAYER_SPEED_X
# Рендеринг
display.fill(WHITE)
player = pygame.draw.rect(display, (134, 124, 140), (PLAYER_X, PLAYER_Y, PLAYER_WIDTH, PLAYER_HEIGHT))
# Показ экрана пользователю
pygame.display.flip()
game()
и ещё параметры
DISPLAY_HEIGHT = 800
DISPLAY_WIDTH = 800
PLAYER_WIDTH = 20
PLAYER_HEIGHT = 20
PLAYER_X = 300
PLAYER_Y = 300
PLAYER_SPEED_X = 0
PLAYER_SPEED_Y = 0
FPS = 60
WHITE = (255, 255, 255)