title: Player movement stops when direction reverses in Pygame
body: <p>I am messing around with pygame and I am eventually working towards a pong clone. I implemented player movement with the arrow keys and when ever I switch from going up to immediately going down, my player freezes and won't move again until I press that direction key again. Here is my code:</p>
  
  <pre><code>import sys, pygame
  
  pygame.init()
  
  display_width = 640
  display_height = 480
  
  display = pygame.display.set_mode((display_width,display_height))
  pygame.display.set_caption("Test Game")
  
  black = (0,0,0)
  white = (255,255,255)
  
  clock = pygame.time.Clock()
  
  running = True
  
  class Player:
  
      def __init__(self,x,y,hspd,vspd,color,screen):
          self.x = x
          self.y = y
          self.hspd = hspd
          self.vspd = vspd
          self.color = color
          self.screen = screen
  
      def draw(self):
          pygame.draw.rect(self.screen,self.color,(self.x,self.y,32,32))
  
      def move(self):
          self.x += self.hspd
          self.y += self.vspd
  
  player = Player(0,0,0,0,black,display)
  
  while running:
  
      clock.tick(60)
  
      for event in pygame.event.get():
  
          if event.type == pygame.QUIT:
              running = False
  
          if event.type == pygame.KEYUP:
              if event.key == pygame.K_RIGHT:
                  player.hspd = 0
              if event.key == pygame.K_LEFT:
                      player.hspd = 0
              if event.key == pygame.K_UP:
                  player.vspd = 0
              if event.key == pygame.K_DOWN:
                  player.vspd = 0
  
          if event.type == pygame.KEYDOWN:
              if event.key == pygame.K_RIGHT:
                  player.hspd = 4
              if event.key == pygame.K_LEFT:
                  player.hspd = -4
              if event.key == pygame.K_UP:
                  player.vspd = -4
              if event.key == pygame.K_DOWN:
                  player.vspd = 4
  
  
      #Clear the screen
      display.fill(white)
  
      #Move objects
      player.move()
      #Draw objects
      player.draw()
  
      #Update the screen
      pygame.display.flip()
  
  print "I made it!"
  pygame.quit()
  sys.exit()
  </code></pre>