Example #1
0
File: world.py Project: parpg/parpg
 def __init__(self, engine):
     '''
     Constructor
     @param engine: Instance of the active fife engine
     @type engine: fife.Engine
     '''
     World.__init__(self, engine)
Example #2
0
 def __init__(self, application):
     self.application = application
     self.object_db = {}
     GameVariables.add_callback(self.update_game_variables)
     self.register_mandatory_components()
     yaml.add_representer(RPGEntity, self.entity_representer,
                          yaml.SafeDumper)
     yaml.add_constructor('!Entity', self.entity_constructor,
                          yaml.SafeLoader)
     yaml.add_representer(helpers.DoublePointYaml,
                          helpers.double_point_representer,
                          yaml.SafeDumper)
     yaml.add_constructor("!DoublePoint",
                          helpers.double_point_constructor,
                          yaml.SafeLoader)
     yaml.add_representer(helpers.DoublePoint3DYaml,
                          helpers.double_point_3d_representer,
                          yaml.SafeDumper)
     yaml.add_constructor("!DoublePoint3D",
                          helpers.double_point_3d_constructor,
                          yaml.SafeLoader)
     World.__init__(self, application.engine)
     self.entities = RPGWorldEntitySet(self)
     self._full_extent = EntityExtent(self, self.entities)
     self._entity_delete_callbacks = set()
     self.__entity_cache = {}
Example #3
0
    def step(self, time_delta):
        """Performs actions every frame

        Args:
            time_delta: Time that passed since the last call
        """
        World.step(self, time_delta)
        checkers = ComponentManager.get_checkers()
        for names, callback in checkers:
            for components in self.components.join(*names):
                callback(*components)
Example #4
0
 def configure(self):
     """Configure the worlds components and systems"""
     World.configure(self)
     components = ComponentManager.get_components()
     for name, component in components.iteritems():
         setattr(self.components, name, component)
     systems = SystemManager.get_systems()
     for name, system in systems.iteritems():
         setattr(self.systems, name, system)
     if not General.registered_as:
         General.register()
Example #5
0
    def step(self, time_delta):
        """Performs actions every frame

        Args:
            time_delta: Time that passed since the last call
        """
        World.step(self, time_delta)
        checkers = ComponentManager.get_checkers()
        for names, callback in checkers:
            for components in self.components.join(*names):
                callback(*components)
Example #6
0
 def configure(self):
     """Configure the worlds components and systems"""
     World.configure(self)
     components = ComponentManager.get_components()
     for name, component in components.items():
         setattr(self.components, name, component)
     systems = SystemManager.get_systems()
     for name, system in systems.items():
         setattr(self.systems, name, system)
     if not General.registered_as:
         General.register()
Example #7
0
 def __init__(self, application):
     self.application = application
     self.object_db = {}
     GameVariables.add_callback(self.update_game_variables)
     if not Agent.registered_as:
         Agent.register()
     if not FifeAgent.registered_as:
         FifeAgent.register()
     if not General.registered_as:
         General.register()
     yaml.add_representer(RPGEntity, self.entity_representer)
     yaml.add_constructor('!Entity', self.entity_constructor,
                          yaml.SafeLoader)
     World.__init__(self, application.engine)