title: Python pygame, moving an object
body: <p>Ive been following a tutorial to learn pygame.
  I have this code to move an object in pygame.</p>
  
  <pre><code>    key = pygame.key.get_pressed()
      dist = 1 # distance moved in 1 frame, try changing it to 5
      if key[pygame.K_DOWN]: # down key
          self.y += dist # move down
      elif key[pygame.K_UP]: # up key
          self.y -= dist # move up
      else:
          self.y = 0
      if key[pygame.K_RIGHT]: # right key
          self.x += dist # move right
      elif key[pygame.K_LEFT]: # left key
          self.x -= dist # move left
      else:
          self.x = 0
  </code></pre>
  
  <p>it works but it isn't very fluid due to the order of sequence. ie if i hold the left button the object will move to the left. if i then press the right button while also holding the left button it will continue to the left. however if i do the opposite of this(hold right toggle left) the object will momentarily go left. Any idea's about how I could get this behaviour to mirror on both sides ?</p>