elif key == keys.Z:
# Vehicle management
from .roach_management import RoachesScene
- return[ChangeSceneEvent(RoachesScene())]
+ return[ChangeSceneEvent(RoachesScene(level_scene=self))]
if offset:
return [MoveViewportEvent(offset)]
return super(GameLevelScene, self).on_key_down(key, mod, unicode)
class RoachesScene(Scene):
""" Roach management scene. """
- def __init__(self):
+ def __init__(self, level_scene=None):
super().__init__()
+ self._level_scene = level_scene
self._vehicle = None
self._seat_pos = 0
self._outside_roach = None
return events
def on_key_down(self, key, mod, unicode):
- if key == keys.ESCAPE:
- from .menu import MenuScene
- return [ChangeSceneEvent(MenuScene())]
+ if key in (keys.ESCAPE, keys.Z):
+ if self._level_scene is None:
+ from .menu import MenuScene
+ return [ChangeSceneEvent(MenuScene())]
+ return [ChangeSceneEvent(self._level_scene)]
def on_mouse_down(self, pos, button):
if button == mouse.LEFT: