title: Pygame - Horizontal Scrolling Map
body: <p>I am having trouble scrolling a map within pygame. Basically I started off uploading a CSV file and putting all the blocks within a list.(self.blocks).</p>
  <p><strong>Map Class</strong> <em>(Credit to Daniel)</em></p>
  <pre class="lang-py prettyprint-override"><code>def draw(self):
      &quot;&quot;&quot;This method draws the map.&quot;&quot;&quot;
      self.blocks = []
      for y, line in enumerate(self.full_map):
          for x, c in enumerate(line):
              if c == &quot;0&quot;:
                  center = ((x*10)+4, (y*10)+4)
                  self.blocks.append(self.dirt_block.get_rect(center=center))
                  self.screen.blit(self.dirt_block, (x * 10, y * 10))
  </code></pre>
  <p><strong>Main Class</strong> <em>(Credit to KidsCanCode)</em></p>
  <pre class="lang-py prettyprint-override"><code>def collide(self):
      for each in self.map.blocks:
          if self.player.rect.colliderect(each):
              # Landing Collision
              if self.player.vel.y &gt; 0:
                  self.player.pos.y = each.top + 1
                  self.player.vel.y = 0
  
              # Jump
              self.player.able_jump = True
              jump = pygame.key.get_pressed()
              if jump[pygame.K_SPACE]:
                  self.player.vel.y = -self.settings.jump_height
  
              if self.player.rect.right &gt;= self.settings.screen_width / 4:
                  self.player.pos.x += abs(self.player.vel.x)
              for plat in self.map.blocks:
                  plat.x += abs(self.player.vel.x)
          else:
              self.player.able_jump = False
  </code></pre>
  <p>I don't know if it is because the blocks have aleady been blitted but I am unable to make them move.</p>