код нормально размещать не умеешь?
попробуй вот такой код.
import pygame
pygame.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("GAME")
player = pygame.image.load("idle.png")
bg = pygame.image.load("bg.png")
x = 50
y = 50
speed = 5
clock = pygame.time.Clock() # Создание объекта Clock
run = True
while run:
clock.tick(60) # Установка частоты кадров (FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
x -= speed
if keys[pygame.K_RIGHT]:
x += speed
if keys[pygame.K_UP]:
y -= speed
if keys[pygame.K_DOWN]:
y += speed
win.blit(bg, (0, 0))
win.blit(player, (x, y))
pygame.display.update()
pygame.quit()
import pygame
pygame.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("GAME")
player = pygame.image.load("idle.png")
bg = pygame.image.load("bg.png")
x = 50
y = 50
speed = 5
run = True
while(run):
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
x -= speed
if keys[pygame.K_RIGHT]:
x += speed
if keys[pygame.K_UP]:
y -= speed
if keys[pygame.K_DOWN]:
y += speed
win.blit(bg, (0, 0))
win.blit(player, (50, 50))
pygame.display.update()
pygame.quit()