- if 0 <= pos[0] < WIDTH:
- if 0 <= pos[1] < HEIGHT:
- screen.blit(tile['image'], pos)
+ self._surface.blit(tile['image'], pos)
+
+ def draw(self, screen, viewport):
+ screen.clear()
+ # Viewport is the position of the screen relative to the
+ # surface. We need the position of the surface relative to
+ # the screen for the blit, so this conversion
+ screen_pos = -viewport[0], -viewport[1]
+ screen.blit(self._surface, screen_pos)