Commits

Anonymous committed 82d6b90

simplified the structure.

Comments (0)

Files changed (2)

 
 """
 
-#### Imports ####
-
-from core import core, run
-from pyglet.clock import schedule_interval
-
-from hexbattle_gui import Interaction
-from hexbattle_logic import Logic
-
-
 ### A "Scene method not implemented" Exception class. 
 
 class MethodNotImplemented(Exception):
 4. Turn the model into a pure state machine.
 """
 
-        
+#### Imports ####
+
+from core import core, run
+from pyglet.clock import schedule_interval
+
+from hexbattle_gui import Interaction
+from hexbattle_logic import Logic
+
+#### Basic Game-Scene API ####        
 
 def start(dt=0):
     """start the scene"""
 IMAGE_TILE_SNOW = [join("graphics", "wesnoth", i) for i in ["deciduous-fall-tile.png",
                                                 "deciduous-winter-tile.png"]] # "forested-deciduous-summer-hills-tile.png", "forested-hills-tile.png"
 
-
-class BaseScene: 
-    """A dummy scene - mostly just the Scene API."""
-    def __init__(self, *args, **kwds): 
-        """Initialize the scene with a core object for basic functions."""
-	
-        ## Necessary attributes for any scene. 
-        #: The core provides basic functions. It gets passed to every scene as first argument. 
-        self.core = core
-        #: Visible sprites. 
-        self.visible = []
-        #: Colliding sprites - this seperation allows for invisible colliders. 
-        self.colliding = []
-        #: Overlay sprites. They are above all other sprites (included for convenience, since most games need an overlay of sorts)
-        self.overlay = []
-        #: A scene to switch to on the next screen update. 
-        self.switch_to_scene = False
-    def update(self): 
-        """Update the stats of all scene objects. """
-        raise MethodNotImplemented(self.update, implementation="""    def update(self):         pass""")
-
-
-class UiState(BaseScene): 
+class UiState: 
     """The Hexbattle Scene.
     
     The UiState has the following roles:
     """
     def __init__(self, logic, *args, **kwds): 
         """Initialize the scene with a core object for basic functions."""
-        BaseScene.__init__(self, *args, **kwds)
         
         #: The Game logic.
         self.logic = logic
         
+        #: the core provides data persistence between scenes.
+        self.core = core
+
         #: The logic tells us what should be visible
         self.visible = self.logic.model.visible
         
+        #: Overlay sprites. They are above all other sprites (included for convenience, since most games need an overlay of sorts)
+        self.overlay = []
+
         #: We still need the hexmap overlay here. The logic does not have to know how an overlay looks.
         self.hexmap_overlay = {}