title: Making Sprite Jump in Pygame
body: <p>Making a basic game and im trying to get my character to jump when space is pressed</p>
  
  <p>I have a simulated gravity that pulls it down when space is released</p>
  
  <p>but when i push space down it goes up and doesnt stop </p>
  
  <p>i want it to only goo up for like 1 second then go back down</p>
  
  <p>Here is my key press handling code snippet:</p>
  
  <pre><code>key = pygame.key.get_pressed()
  if key[pygame.K_LEFT]:
      self.rect.x -= 30
  if key[pygame.K_RIGHT]:
      self.rect.x += 30
  if key[pygame.K_SPACE]:
      self.rect.y += -20
  if key[pygame.K_SPACE] == False:
      self.rect.y += 20
  </code></pre>
  
  <p>like i said this code makes the sprite go up when space is pressed and down when space is released but when it is pressed i want it to wait one second then make the sprite go back down even if the space bar is still down</p>
  
  <p>Please help!! </p>
  
  <p>thank you</p>