title: having a problem with error UnboundLocalError: local variable 'player' referenced before assignment
body: <p>finishing up the last game in the video tutorial I have been using to learn <em>python</em>/<em>pygame</em> coding.</p>
  <p>When I ran the game, the following error is showing:</p>
  <pre><code>File &quot;/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py&quot;, line 82, in GameInterface
      if player.cooling_time &gt; 0:
  UnboundLocalError: local variable 'player' referenced before assignment.
  </code></pre>
  <p>I have absolutely no idea at all what this means or how to correct it considering it is EXACTLY like the source code I got as part of the learning material.</p>
  <p>Traceback:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py&quot;, line 160, in &lt;module&gt;
      main()
    File &quot;/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py&quot;, line 152, in main
      GameInterface(num_player=1, screen=screen)
    File &quot;/home/dev/PycharmProjects/game7_meteor_game/game7_meteor_game.py&quot;, line 82, in GameInterface
      if player.cooling_time &gt; 0:
  UnboundLocalError: local variable 'player' referenced before assignment
  </code></pre>
  <p>My code:</p>
  <pre><code>   ----&gt;if player.cooling_time &gt; 0:
                  player.cooling_time -= 1&lt;------ 
  
          if (score_1 + score_2) &lt; 500:
              background = bg_1
          elif (score_1 + score_2) &lt; 1500:
              background = bg_2
          else:
              background = bg_3
  
  </code></pre>