title: AttributeError: 'pygame.Surface' object has no attribute 'rect'
body: <p>I keep getting this error. Here's the full traceback.</p>
  
  <pre><code>Traceback (most recent call last):
  File "C:/Users/Luc/PycharmProjects/game_practice/game.py", line 23, in 
  &lt;module&gt;
  run_game()
  File "C:/Users/Luc/PycharmProjects/game_practice/game.py", line 13, in 
  run_game
  player = Player(ai_settings, screen)
  File "C:\Users\Luc\PycharmProjects\game_practice\player.py", line 8, in 
  __init__
  self.rect.centerx = screen.rect.left
  AttributeError: 'pygame.Surface' object has no attribute 'rect'
  </code></pre>
  
  <p>Here's the code for the "Player" file that's having an issue:</p>
  
  <pre><code>class Player:
      def __init__(self, ai_settings, screen):
          self.screen = screen
          self.screen_rect = screen.get_rect()
          self.rect = pygame.Rect((0, 0), (ai_settings.player_width, 
          ai_settings.player_height))
          self.rect.centerx = screen.rect.left
          self.rect.centery = screen.rect.ai_settings.screen_height / 2
          self.color = ai_settings.player_color
  
      def draw_player(self):
          pygame.draw.rect(self.screen, self.color, self.rect)
  </code></pre>
  
  <p>When I comment these two lines:</p>
  
  <pre><code>self.rect.centerx = screen.rect.left
  self.rect.centery = screen.rect.ai_settings.screen_height / 2
  </code></pre>
  
  <p>The program runs with the rectangle initialized at (0,0) like its supposed to, so I am not really sure why the object has an attribute error when I include the other lines.</p>