def enter(self, world):
self._level_data = levels.load(world.level.name)
self._tiles = self._level_data['tiles']
- self._layer = 'floor'
+ self._level_layer = 'floor'
self._surfaces = {}
self._overlay = {}
for layer in ['floor', 'tunnels']:
# surface. We need the position of the surface relative to
# the screen for the blit, so this conversion
screen_pos = -viewport[0], -viewport[1]
- if self._layer == 'floor':
- screen.blit(self._surfaces[self._layer], screen_pos)
+ if self._level_layer == 'floor':
+ screen.blit(self._surfaces[self._level_layer], screen_pos)
else:
# blit tunnels, with translucent overlay
# We need to call pygame.Surface.blit ourselves,
# since pgzero's screen blit hides the blend flags
# from us
- tunnels = self._surfaces[self._layer].copy()
+ tunnels = self._surfaces[self._level_layer].copy()
tunnels.blit(self._overlay, (0, 0),
special_flags=pgl.BLEND_MULT)
screen.blit(tunnels, screen_pos)
elif key == keys.RIGHT:
offset = (TILE_SIZE, 0)
elif key == keys.S:
- if self._layer == 'floor':
- self._layer = 'tunnels'
+ if self._level_layer == 'floor':
+ self._level_layer = 'tunnels'
else:
- self._layer = 'floor'
+ self._level_layer = 'floor'
return
if offset:
return [MoveViewportEvent(offset)]