From: Simon Cross Date: Sun, 4 Sep 2016 14:39:06 +0000 (+0200) Subject: Add a night scene skeleton. X-Git-Tag: tabakrolletjie-v1.0.0~264 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=30a1b3797e53d8ed989ca9dc530290a87bce0da0;p=tabakrolletjie.git Add a night scene skeleton. --- diff --git a/tabakrolletjie/scenes/menu.py b/tabakrolletjie/scenes/menu.py index 1569d30..f9658a9 100644 --- a/tabakrolletjie/scenes/menu.py +++ b/tabakrolletjie/scenes/menu.py @@ -4,11 +4,17 @@ import pygame.event import pygame.locals as pgl from .base import BaseScene -from ..events import QuitEvent +from ..events import QuitEvent, SceneChangeEvent class MenuScene(BaseScene): + def render(self, surface, gamestate): + surface.fill((0, 255, 0)) + def event(self, ev, gamestate): if ev.type == pgl.KEYDOWN: if ev.key in (pgl.K_q, pgl.K_ESCAPE): QuitEvent.post() + elif ev.key == pgl.K_n: + from .night import NightScene + SceneChangeEvent.post(scene=NightScene()) diff --git a/tabakrolletjie/scenes/night.py b/tabakrolletjie/scenes/night.py index e69de29..daea44d 100644 --- a/tabakrolletjie/scenes/night.py +++ b/tabakrolletjie/scenes/night.py @@ -0,0 +1,18 @@ +""" In the night, the mould attacks. """ + +import pygame.event +import pygame.locals as pgl + +from .base import BaseScene +from ..events import SceneChangeEvent + + +class NightScene(BaseScene): + def render(self, surface, gamestate): + surface.fill((0, 0, 255)) + + def event(self, ev, gamestate): + if ev.type == pgl.KEYDOWN: + if ev.key in (pgl.K_q, pgl.K_ESCAPE): + from .menu import MenuScene + SceneChangeEvent.post(scene=MenuScene())