import pygame
win = pygame.display.set_mode((500,500))
pygame.display.set_caption('Ghost house')
y=50
x = 50
widht = 40
height = 60
speed = 5
run = trye
while run:
pygame.time.delay(500)
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
pygame.draw.rect(win, (0,255,0), (x,y,width,height))
pygame.display.update