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, 255))
27 for obs in self._obstacles:
29 for light in self._lights:
32 def event(self, ev, gamestate):
33 if ev.type == pgl.KEYDOWN:
34 if ev.key in (pgl.K_q, pgl.K_ESCAPE):
35 from .menu import MenuScene
36 SceneChangeEvent.post(scene=MenuScene())