Mercurial > parpg-source
comparison world.py @ 157:79d6b17b80a3
Implemented simple script system.
author | KarstenBock@gmx.net |
---|---|
date | Sat, 12 Nov 2011 16:27:39 +0100 |
parents | aed2e094e0c7 |
children | 75c0b728ccf3 |
comparison
equal
deleted
inserted
replaced
156:0655f2f0f3cd | 157:79d6b17b80a3 |
---|---|
1 from parpg.bGrease.world import * | 1 from parpg.bGrease.world import * |
2 from parpg.bGrease.component import Component | 2 from parpg.bGrease.component import Component |
3 | 3 |
4 from parpg.mode import FifeMode | 4 from parpg.mode import FifeMode |
5 from parpg import components | 5 from parpg import components |
6 from parpg.systems import ScriptingSystem | |
6 | 7 |
7 class World(FifeMode, BaseWorld): | 8 class World(FifeMode, BaseWorld): |
8 | 9 |
9 def __init__(self): | 10 def __init__(self): |
10 FifeMode.__init__(self) | 11 FifeMode.__init__(self) |
12 | 13 |
13 def configure(self): | 14 def configure(self): |
14 """Configure the game world's components, systems and renderers""" | 15 """Configure the game world's components, systems and renderers""" |
15 for name, component in components.components.iteritems(): | 16 for name, component in components.components.iteritems(): |
16 setattr(self.components, name, component) | 17 setattr(self.components, name, component) |
18 self.systems.scripting = ScriptingSystem({}) | |
17 | 19 |
18 def pump(self, dt): | 20 def pump(self, dt): |
19 for component in self.components: | 21 for component in self.components: |
20 if hasattr(component, "step"): | 22 if hasattr(component, "step"): |
21 component.step(dt) | 23 component.step(dt) |