0
0 Комментариев
import pygame
 pygame.init()
win = pygame.display.set_mode((650,650))
 pygame.display.set_caption("First Game")
 x = 50
y = 50
width = 40
height = 60
vel = 5
 play = True
while play:
 pygame.time.delay(100)
 for event in pygame.event.get():
 if event.type == pygame.QUIT:
  play = False
 keys = pygame.key.get_pressed()
if keys [pygame.K_LEFT]:
 x-= vel
if keys [pygame.K_RIGHT]:
 x+= vel
if keys [pygame.K_Up]:
 y-= vel
if keys [pygame.K_DOWN]:
   y+= vel
 pygame.draw.rect(win, (255, 0, 0), (x, y, width, height))
pygame.display.update()
 pygame.quit()


Добавить комментарий