Add a night scene skeleton.
authorSimon Cross <hodgestar@gmail.com>
Sun, 4 Sep 2016 14:39:06 +0000 (16:39 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sun, 4 Sep 2016 14:39:06 +0000 (16:39 +0200)
tabakrolletjie/scenes/menu.py
tabakrolletjie/scenes/night.py

index 1569d30c975b80efa01e76a89dc3979436b24812..f9658a9c545b84a2fc0a2f0d99b04f9f60a8ec69 100644 (file)
@@ -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())
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..daea44d8b927b0bf78d0ebd4b44377e63de8814a 100644 (file)
@@ -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())