Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pygame getting your charecter to jump

#how i made my charecter jump with pygame
   if not(is_jump):
        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]:
            is_jump = True
    else:
        if jump_count >= -10:
            nIg = 1
            if jump_count < 0:
                nIg = -1
            y -= (jump_count ** 2) * 0.5 * nIg
            jump_count -= 1

        else:
            is_jump = False
            jump_count = 10
 
PREVIOUS NEXT
Tagged: #pygame #charecter #jump
ADD COMMENT
Topic
Name
8+7 =