title: I want to make my character jump in pygame and it's not working
body: <p>I tried to make my character jump and it's not working. So when I press SPACE the y position should decrement to make my player go up and when he reaches the top I wanted to make it come down again.
  I don't know what to say the site makes me describe the problem even more to post it so here am I am writing words :)</p>
  <p>This is the code by now:</p>
  <pre><code>import pygame
  import time
  import random
  #variabile
  velPlayer = 1
  xPlayer = 100
  yPlayer = 100
  
  #initializare
  pygame.init()
  
  screen = pygame.display.set_mode((1000,1000))
  pygame.display.set_caption(&quot;Joculet&quot;)
  
  #fundal
  def ecranAlb():
      screen.fill((255,255,255))
  
  #player   
  def player():
      global xPlayer, yPlayer
      isJump = False
      jumpCount = 10
      pygame.draw.rect(screen,(0,0,253),(xPlayer,yPlayer,15,15))
      keys = pygame.key.get_pressed()
  
      if keys[pygame.K_RIGHT] and xPlayer &lt; 971:
          xPlayer += velPlayer
      if keys[pygame.K_LEFT] and xPlayer &gt; 0:
          xPlayer -= velPlayer
      if not(isJump):
          if keys[pygame.K_UP] and yPlayer &gt; 0:
              yPlayer -= velPlayer
          if keys[pygame.K_DOWN] and yPlayer &lt; 970:
              yPlayer += velPlayer
          if keys[pygame.K_SPACE]:
              isJump = True
      else:
          if jumpCount &gt;= -10:
              neg = 1
              if jumpCount &lt; 0:
                  neg = -1
  
              yPlayer = (jumpCount ** 2) * 0.5 * neg
              jumpCount -= 1
          else:
              isJump = False
              jumpCount = 10
  
  #main loop   
  running = True
  
  while running:
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              running = False
  
      ecranAlb()
      player()
      pygame.display.flip()
  
  pygame.quit()
  </code></pre>