import pygame
pygame.init()

win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("First Game")

# Shit vars
x, y = 50, 50
width, height = 40, 60
vel = 5
isJump = False
jumpCount = 10

# Animation Vars
left = False
Right = False
walkCount = 0

# https://www.techwithtim.net/tutorials/game-development-with-python/pygame-tutorial/pygame-animation

walkRight = [pygame.image.load]

run = True

while run:
    pygame.time.delay(20)
    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 > vel:
        x -= vel
    if keys[pygame.K_RIGHT] and x < 500 - vel - width:
        x += vel

    if isJump is False:
        if keys[pygame.K_UP] and y > vel:
            y -= vel
        if keys[pygame.K_DOWN] and y < 500 - height - vel:
            y += vel
        if keys[pygame.K_SPACE]:
            isJump = True
    else:
        if jumpCount >= -10:
            y -= (jumpCount * abs(jumpCount)) * 0.5
            jumpCount -= 1
        else:
            jumpCount = 10
            isJump = False
    
    win.fill((0, 0, 0))
    pygame.draw.rect(win, (255,0,0), (x, y, width, height))
    pygame.display.update()



pygame.quit()