view world.py @ 158:04854cf6e1ac

The approach method of MovingAgentBehaviour now accepts a locatior or another instance, and uses the follow method to move to the instance position.
author KarstenBock@gmx.net
date Sat, 12 Nov 2011 20:54:25 +0100
parents 79d6b17b80a3
children 75c0b728ccf3
line wrap: on
line source

from parpg.bGrease.world import *
from parpg.bGrease.component import Component

from parpg.mode import FifeMode
from parpg import components
from parpg.systems import ScriptingSystem

class World(FifeMode, BaseWorld):

    def __init__(self):
        FifeMode.__init__(self)
        BaseWorld.__init__(self)
        
    def configure(self):
        """Configure the game world's components, systems and renderers"""
        for name, component in components.components.iteritems():
            setattr(self.components, name, component)
        self.systems.scripting = ScriptingSystem({})
    
    def pump(self, dt):
        for component in self.components:
            if hasattr(component, "step"):
                component.step(dt)
        for system in self.systems:
            if hasattr(system, "step"):
                system.step(dt)