changeset 520:dfb6e57feebe

Move scene specifications into gamelib.scenes
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 07 Sep 2010 18:25:29 +0200
parents 8f3c82c685a4
children d143947690d9
files gamelib/scenes/__init__.py gamelib/state.py
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/scenes/__init__.py	Tue Sep 07 18:13:35 2010 +0200
+++ b/gamelib/scenes/__init__.py	Tue Sep 07 18:25:29 2010 +0200
@@ -1,1 +1,13 @@
 """Package for holding scenes."""
+
+SCENE_LIST = [
+        "cryo",
+        "bridge",
+        "mess",
+        "engine",
+        "machine",
+        "crew_quarters",
+        "map",
+        "manual",
+        ]
+INITIAL_SCENE = 'cryo'
--- a/gamelib/state.py	Tue Sep 07 18:13:35 2010 +0200
+++ b/gamelib/state.py	Tue Sep 07 18:25:29 2010 +0200
@@ -9,6 +9,7 @@
 from pygame.color import Color
 
 import constants
+from scenes import SCENE_LIST, INITIAL_SCENE
 from sound import get_sound
 
 # override the initial scene to for debugging
@@ -59,15 +60,9 @@
 def initial_state():
     """Load the initial state."""
     state = GameState()
-    state.load_scenes("cryo")
-    state.load_scenes("bridge")
-    state.load_scenes("mess")
-    state.load_scenes("engine")
-    state.load_scenes("machine")
-    state.load_scenes("crew_quarters")
-    state.load_scenes("map")
-    state.load_scenes("manual")
-    initial_scene = "cryo" if DEBUG_SCENE is None else DEBUG_SCENE
+    for scene in SCENE_LIST:
+        state.load_scenes(scene)
+    initial_scene = INITIAL_SCENE if DEBUG_SCENE is None else DEBUG_SCENE
     state.set_current_scene(initial_scene)
     state.set_do_enter_leave()
     return state