title: Pygame: How do I get KEYDOWN to input only once?
body: <p>Hi I'm creating a game where I have multiple stages. I want to make it so that every time the user presses the key <code>a</code>, the next stage will trigger. Here is a sample of my code.</p>
  
  <pre><code>gameStage = 0 ## outside while loop
  
  ##INSIDE whileloop
  if gameStage == 0:
      ##insert drawings,music, etc
      if event.type == pygame.KEYDOWN:
         if event.key == pygame.K_a:
              gameStage += 1
  
  if gameStage == 1:
      ##insert drawings,music, etc
      if event.type == pygame.KEYDOWN:
         if event.key == pygame.K_a:
              gameStage += 1
  </code></pre>
  
  <p>my problem is that when the user presses the <code>a</code> key, <code>a</code> will be input more than once depending how long the key is held. Therefore, it will just skip all the way to my last stage. How do I make it so that the <code>gameStage</code> is +=1 only when the key has been pressed AND lifted? Please tell me if I'm being unclear. Appreciate any help. Thanks.</p>