x = 50
y = 50
wight = 40
height = 60
speed = 5
isJump == False #прыгает ли персонаж сейчас
JumpCount = 10 # высота прыжка
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT] and x > 5:
x -= speed
if keys[pygame.K_RIGHT] and x < 500 - wight - 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]: #если нажата кнопка SPACE, то isJump == True
isJump == True
else:
if JumpCount >= -10:
y -= (JumpCount ** 2) / 2
JumpCount -= 1
else:
isJump == Faslse
JumpCount = 10