1 """ In the night, the mould attacks. """
3 import pygame.locals as pgl
7 from .base import BaseScene
8 from ..lights import BaseLight
9 from ..obstacles import BaseObstacle
10 from ..events import SceneChangeEvent
13 class NightScene(BaseScene):
14 def enter(self, gamestate):
15 self._space = pymunk.Space()
17 BaseObstacle.load(cfg) for cfg in gamestate.station["obstacles"]]
19 BaseLight.load(cfg) for cfg in gamestate.station["lights"]]
20 for obs in self._obstacles:
22 for light in self._lights:
23 light.add(self._space)
25 def render(self, surface, gamestate):
26 surface.fill((0, 0, 155))
27 for light in self._lights:
28 light.render_light(surface)
29 for obs in self._obstacles:
31 for light in self._lights:
34 def event(self, ev, gamestate):
35 if ev.type == pgl.KEYDOWN:
36 if ev.key in (pgl.K_q, pgl.K_ESCAPE):
37 from .menu import MenuScene
38 SceneChangeEvent.post(scene=MenuScene())