for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT] and x > 5:
x -= speed
if keys[pygame.K_RIGHT] and x < 500 - widht - 5:
x += speed
if not(isJump):
if keys[pygame.K_UP] and y > 5:
y -= speed
if keys[pygame.K_DOWN] and y < 500 - height - 5:
y += speed
if keys[pygame.K_SPACE]:
isJump = True
else:
if jumpCount >= -10:
if jumpCount > 0:
y += (jumpCount ** 2) / 2
else:
y -= (jumpCount ** 2) / 2
jumpCount -= 1
else:
isJump = False
jumpCount = 10