title: How to make gravity function in pygame?
body: <p><b>Unable to move player in pygame</b><br><br>
  So, I was trying to create a simple physics system in pygame. My main goal was to add a Y gravity function that would move the player when activated. I have tried several times to make it work, but I guess I am missing something.<br><br>
  Here is the code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class Physic:
      def __init__(self, color, master, type, sizeX, sizeY, pos=[0,0]):
          self.master = master
          self.color = color
          self.type = type
          self.sizeX = sizeX
          self.sizeY = sizeY
          self.x = pos[0]
          self.y = pos[1]
  
          self.moveX = 0
          self.moveY = 0
  
          self.create_Object()
  
  
      def create_Object(self):
          if self.type == 'rect':
              self.rect()
  
      def rect(self):
          return pygame.draw.rect(self.master, self.color, (self.x, self.y, self.sizeX, self.sizeY))
  
      def drag(self):
          for event in pygame.event.get():
              if event.type == pygame.mouse.get_pressed()[0]:
                  self.x = pygame.mouse.get_pos()
  
      def add_gravity(self):
          self.moveY += 3.2
          self.update_pos()
  
      def update_pos(self):
          self.y += self.moveY
          self.x += self.moveX</code></pre>
  </div>
  </div>
  </p>
  <hr />
  <p>In the main script I put this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>def game():
      while True:
          for event in pygame.event.get():
              if event.type == pygame.QUIT:
                  sys.exit()
  
  
          screen.fill(WHITE)
  
          player = object.Physic(BLUE, screen, 'rect', 50, 50, [POS[0], POS[1]])
          player.add_gravity()
  
          # platform = object.rect(screen, RED, [30, 30], 100, 30)
  
  
          # physics.add_collider(player, platform, POS[0])
  
          pygame.display.update()
  
  
  game()</code></pre>
  </div>
  </div>
  </p>
  <p><b><i>Do you know what I am missing?</i></b></p>