changeset 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 62d8d545260c
children 7c6e2e39b545
files src/parpg/entities/character.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/parpg/entities/character.py	Sun Sep 04 13:44:10 2011 +0200
+++ b/src/parpg/entities/character.py	Sun Sep 04 15:19:47 2011 +0200
@@ -15,7 +15,8 @@
 
 class Character(Entity):
     def __init__(self, world, view_name, real_name, desc, statistics, max_bulk,
-            items=None):
+                 identifier, layer=None, behaviour=None, gfx=None, items=None
+                 ):
         self.characterstats.statistics = statistics
         
         self.description.view_name = view_name
@@ -24,3 +25,13 @@
         
         self.container.children = items or []
         self.container.max_bulk = max_bulk
+        
+        self.fifeagent.identifier = identifier
+        self.fifeagent.layer = layer
+        self.fifeagent.behaviour = behaviour
+        self.fifeagent.gfx = gfx
+        
+    def setup_behaviour(self):
+        """Attach the behaviour to the layer"""
+        if self.fifeagent.behaviour:        
+            self.fifeagent.behaviour.attachToLayer(self.fifeagent.identifier)