From 30a1b3797e53d8ed989ca9dc530290a87bce0da0 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sun, 4 Sep 2016 16:39:06 +0200 Subject: [PATCH] Add a night scene skeleton. --- tabakrolletjie/scenes/menu.py | 8 +++++++- tabakrolletjie/scenes/night.py | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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()) -- 2.34.1