title: Python Pygame Player is ALWAYS centered
body: <p>I've seen the pages on like scrolling cameras, and the camera movement, but I just want it simpler. I don't want the camera to follow the player off screen, I just want the camera to always center on the player, like the player is always in the center of the screen. 
  If you need, heres the files + code:
  my main.py</p>
  
  <pre><code>    import pygame, sys
      from pygame.locals import *
      from engineTiles import Tile
      from classlibEntities import *
      import Functions
      from interaction import interaction
      pygame.init()
      pygame.font.init()
  
  
      invalids =   (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
                   19,37,55,73,91,109,127,145,163,181,
                   182,183,184,185,186,187,188,189,190,
                   191,192,193,194,195,196,197,198,
                   36,54,72,90,108,126,144,162,180,198)
      SCREENWIDTH = 720
      SCREENHEIGHT = 440
      DrawNumbers = True
      window = pygame.display.set_mode((SCREENWIDTH, SCREENHEIGHT))
      for y in range(0, window.get_height(), 40):
          for x in range(0, window.get_width(), 40):
              if Tile.total_tiles in invalids:
                  Tile(x, y, 'solid')
              else:
                  Tile(x, y, 'empty')
      pygame.display.set_caption("Until Death - Core Architecture Build 04")
      fpsclock = pygame.time.Clock()
      FPS = 60
      zombie1 = EntityZombie(200, 240)
      player = EntityPlayer(400, 120)
      # ------- Main Game Loop -------
      while True:
          interaction(window, player)
      # ------- All GameLogic -------
          Tile.draw_tiles(window)
          if DrawNumbers == True:
              Tile.draw_tilenumbers(window)
          player.draw(window)
          EntityZombie.draw_zombies(window)
          pygame.display.update()
  
          fpsclock.tick(FPS)
  </code></pre>
  
  <p>Any my tile class</p>
  
  <pre><code>    import pygame, Functions
  
      class Tile(pygame.Rect):
          List = []
          width, height = 40, 40
          total_tiles = 1
          H, V = 1, 18
          def __init__(self, x, y, Type):
  
              self.type = Type
              self.number = Tile.total_tiles
              Tile.total_tiles += 1
  
              if Type == 'empty':
                  self.walkable = True
              else:
                  self.walkable = False
  
              pygame.Rect.__init__(self, (x, y), (Tile.width, Tile.height))
  
              Tile.List.append(self)
  
          @staticmethod
          def get_tile(number):
              for tile in Tile.List:
                  if tile.number == number:
                      return tile
  
          @staticmethod
          def draw_tiles(window):
              for tile in Tile.List:
                  if not(tile.type == 'empty'):
                      if tile.type == 'solid':
                          pygame.draw.rect(window, [40, 40, 40], tile)
                  else:
                      pygame.draw.rect(window, [0, 0, 0], tile)
          @staticmethod
          def draw_tilenumbers(window):
              for tile in Tile.List:
                      Functions.text_to_screen(window, tile.number, tile.x, tile.y)
  </code></pre>
  
  <p>And finally the class that has the player stuff in it.</p>
  
  <pre><code>    import pygame
      from engineTiles import Tile
      class Entity(pygame.Rect):
          width, height = 40, 40
  
          def __init__(self, x, y):
  
              pygame.Rect.__init__(self, x, y, EntityPlayer.width, EntityPlayer.height)
          def __str__(self):
              return str(self.get_number())
          def get_number(self):
  
              return ((self.x / self.width) + Tile.H) + (self.y / self.height) * Tile.V
  
          def get_tile(self):
  
              return Tile.get_tile(self.get_number())
  
      class EntityZombie(Entity):
  
          List = []
  
          def __init__(self, x, y):
  
              Entity.__init__(self, x, y)
              EntityZombie.List.append(self)
  
          @staticmethod
          def draw_zombies(window):
              for zombie in EntityZombie.List:
                  pygame.draw.rect(window, [210, 24, 77], zombie)
  
      class EntityPlayer(Entity):
  
          def __init__(self, x, y):
  
              Entity.__init__(self, x, y)
  
          def draw(self, window):
              r = int (self.width / 2)
              pygame.draw.circle(window, [77, 234, 156], (self.x + r, self.y + r), r)
  </code></pre>