title: PyGame Character not moving left
body: <p>I have following issue: The character is not moving left properly. I tried to debug and saw that in the drawfrantz function the moveLeft is not true but in the while game loop it is. I have tried a lot, like setting global and more but it seems simply not to work. i followed a yt tutorial, heres the link
  <a href="https://www.youtube.com/watch?v=9Kh9s9__ywo" rel="nofollow noreferrer">https://www.youtube.com/watch?v=9Kh9s9__ywo</a></p>
  <pre><code>import pygame
  pygame.init()
  
  display_width = 1280
  display_height = 720
  
  x = 250
  y = 250
  velocity = 10
  moveRIGHT = False
  moveLeft = False
  stepIndex = 0
  
  screen = pygame.display.set_mode((display_width, display_height))
  pygame.display.set_caption(&quot;Frantz Reichts!&quot;)
  clock = pygame.time.Clock()
  
  frantz_stationary = pygame.image.load(&quot;assets/frantz/trash_ting3.png&quot;)
  
  frantz_going_left = [None]*10
  for indexofpic in range(1,9):
      frantz_going_left[indexofpic-1] = pygame.image.load(&quot;assets/frantz/L&quot; + str(indexofpic) + &quot;.png&quot;)
      indexofpic = (indexofpic + 1)
  
  frantz_going_right = [None]*10
  for picindex in range(1,9):
      frantz_going_right[picindex-1] = pygame.image.load(&quot;assets/frantz/R&quot; + str(picindex) + &quot;.png&quot;)
      picindex = (picindex + 1)
  
  
  
  
  
  # Images #
  stage1full = pygame.image.load(&quot;assets/WholeStage.png&quot;)
  karavane = pygame.image.load(&quot;assets/Karavane.png&quot;)
  
  def DrawFrantz():
      global stepIndex
      if stepIndex &gt;= 8:
          stepIndex = 0
      if moveLeft == True:
          screen.blit(frantz_going_left[stepIndex], (x, y))
          stepIndex += 1
      elif moveRIGHT == True:
          screen.blit(frantz_going_right[stepIndex], (x, y))
          stepIndex += 1
      else:
          screen.blit(frantz_stationary, (x, y))
  
  while(True): #Game Loop
      screen.fill((0, 0, 0))
      screen.blit(stage1full, (0, 0))
      screen.blit(karavane, (0,0))
  
      DrawFrantz()
  
      userInput = pygame.key.get_pressed()
      if userInput[pygame.K_a]:
          x -= velocity
          moveLeft = True
          moveRIGHT = False
          
      if userInput[pygame.K_d]:
          x += velocity
          moveLeft = False
          moveRIGHT = True
      else:
          moveLeft = False
          moveRIGHT = False
          stepIndex = 0
  
  
      for event in pygame.event.get():
          if event.type == pygame.QUIT:
              pygame.quit()
              quit()
  
      pygame.time.delay(100)
      pygame.display.update()
      clock.tick(60)
  
  </code></pre>