X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=tabakrolletjie%2Fscenes%2Fnight.py;h=bb362b53a42b33281449819eb4255e737d80e214;hb=7f10fb40bd02b5048d2086b85e48282662a59be0;hp=27ab21c7b31169b7e6c25d365f563e4cac446b4e;hpb=fbdef20efb7ebc5f3e570766089247feeb387179;p=tabakrolletjie.git diff --git a/tabakrolletjie/scenes/night.py b/tabakrolletjie/scenes/night.py index 27ab21c..bb362b5 100644 --- a/tabakrolletjie/scenes/night.py +++ b/tabakrolletjie/scenes/night.py @@ -2,13 +2,32 @@ import pygame.locals as pgl +import pymunk + from .base import BaseScene +from ..lights import BaseLight +from ..obstacles import BaseObstacle from ..events import SceneChangeEvent class NightScene(BaseScene): + def enter(self, gamestate): + self._space = pymunk.Space() + self._obstacles = [ + BaseObstacle.load(cfg) for cfg in gamestate.station["obstacles"]] + self._lights = [ + BaseLight.load(cfg) for cfg in gamestate.station["lights"]] + for obs in self._obstacles: + obs.add(self._space) + for light in self._lights: + light.add(self._space) + def render(self, surface, gamestate): - surface.fill((0, 0, 255)) + surface.fill((0, 0, 155)) + for obs in self._obstacles: + obs.render(surface) + for light in self._lights: + light.render(surface) def event(self, ev, gamestate): if ev.type == pgl.KEYDOWN: