title: Character slowly falling through floor instead of coming to a complete stop
body: <p>My character is slowly falling through the ground instead of a complete stop. The collision code is in the 4th function called def update():. I do have a second file that mainly deals with sprite collision which is where the self.player imports are coming from but it shouldn't have much of an impact on the problem.</p>
  <pre><code>import pygame as pg
  from settings import *
  from sprites import *
  
  class Game:
   def __init__(self):
      # ==============================================================================================================
      # initialize game window, etc
      pg.init()
      pg.mixer.init()
      self.screen = pg.display.set_mode(SCREEN)
      pg.display.set_caption(TITLE)
      self.clock = pg.time.Clock()
      self.spritesheet = Spritesheet(Mario)
      self.running = True
  
  def new(self):
      # ==============================================================================================================
      # start a new game
      self.all_sprites = pg.sprite.LayeredUpdates()
      self.player = pg.sprite.Group()
      self.platforms = pg.sprite.Group()
      self.player = Player(self)
      self.level()
      self.run()
  
  def run(self):
      # ==============================================================================================================
      # Game Loop
      self.playing = True
      while self.playing:
          self.clock.tick(FPS)
          self.events()
          self.update()
          self.draw()
  
  
  def update(self):
      # Game Loop - Update
      self.all_sprites.update()
  
      # ==============================================================================================================
      # COLLISION BETWEEN PLAYER AND PLATFORMS GROUP
      hits = pg.sprite.spritecollide(self.player, self.platforms, False)
  
      # ==============================================================================================================
      # GOING RIGHTWARDS COLLISION
      if self.player.vel.x &gt; 0:
          if hits:
              for hit in hits:
                  if self.player.rect.right &gt; hit.rect.right:
                      self.player.rect.right = hit.rect.right
                      self.player.vel.x = 0
                      self.player.rect.midbottom = self.player.pos
  
      # ==============================================================================================================
      # GOING LEFT WARDS COLLISION
      elif self.player.vel.x &lt; 0:
          if hits:
              for hit in hits:
                  if self.player.rect.left &lt; hit.rect.left:
                      self.player.rect.right = hit.rect.left
                      self.player.vel.x = 0
                      self.player.rect.midbottom = self.player.pos
  
      # ==============================================================================================================
      # ASCENDING COLLISION
      elif self.player.vel.y &lt; 0:
          if hits:
              for hit in hits:
                  if self.player.rect.top &gt; hit.rect.bottom:
                      self.player.rect.top = hit.rect.bottom
                      self.player.vel.y = 0
                      self.player.jumping = False
                      self.player.rect.midbottom = self.player.pos
  
      # ==============================================================================================================
      # FALLING COLLISION
      elif self.player.vel.y &gt; 0:
          if hits:
              for hit in hits:
                  if hit.rect.top:
                      self.player.rect.bottom = hit.rect.top
                      self.player.vel.y = 0
                      self.player.jumping = False
                      self.player.rect.midbottom = self.player.pos
  
  
  
  def events(self):
      # Game Loop - events
      for event in pg.event.get():
          # check for closing window
          if event.type == pg.QUIT:
              self.playing = False
              self.running = False
          if event.type == pg.KEYDOWN:
              if event.key == pg.K_SPACE:
                  self.player.jump()
          if event.type == pg.KEYUP:
              if event.key == pg.K_SPACE:
                  self.player.jump_cut()
  
  def level(self):
      # ==============================================================================================================
      # MAKE LEVEL
      self.levelsss = level
      y=0
      for row in self.levelsss:
          x = 0
          for col in row:
              if col == &quot;1&quot;:
                  block(self, x, y)
              x += 1
          y+= 1
  
  
  def draw(self):
      # ==============================================================================================================
      # DRAW SPRITES
      self.screen.fill(DEEP_SKY_BLUE)
      self.all_sprites.draw(self.screen)
      # *after* drawing everything, flip the display
      pg.display.flip()
  
  def show_start_screen(self):
      # game splasrh/start screen
      pass
  
  def show_go_screen(self):
      # game over/continue
      pass
  
  g = Game()
  g.show_start_screen()
  while g.running:
    g.new()
    g.show_go_screen()
  
  pg.quit()
  </code></pre>