Mercurial > parpg-core
annotate src/parpg/world.py @ 52:872e9ca29969
Added fifeagent as component to the Character entity and added a method that attaches the behaviour to the layer
author | KarstenBock@gmx.net |
---|---|
date | Sun, 04 Sep 2011 15:19:47 +0200 |
parents | 94cb5843dcbb |
children | b15cf999216a |
rev | line source |
---|---|
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
1 from parpg.grease.world import * |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
2 from parpg.mode import FifeMode |
27 | 3 |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
4 class World(FifeMode, BaseWorld): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
5 |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
6 def __init__(self): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
7 FifeMode.__init__(self) |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
8 BaseWorld.__init__(self) |
27 | 9 |
10 def pump(self, dt): | |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
11 for component in self.components: |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
12 if hasattr(component, "step"): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
13 component.step(dt) |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
14 for system in self.systems: |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
15 if hasattr(system, "step"): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
16 system.step(dt) |