- if 0 <= pos[0] < WIDTH:
- if 0 <= pos[1] < HEIGHT:
- screen.blit(tile['image'], pos)
+ surface.blit(tile[layer_key], pos)
+ return surface.convert_alpha()
+
+ 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.surface.blit(self._surfaces[self._level_layer], (0, 0),
+ area=(viewport[0], viewport[1], WIDTH, HEIGHT))
+ if self._level_layer != 'floor':
+ screen.surface.blit(self._overlay, (0, 0),
+ area=(viewport[0], viewport[1], WIDTH, HEIGHT),
+ special_flags=pgl.BLEND_MULT)