# HG changeset patch # User KarstenBock@gmx.net # Date 1315142387 -7200 # Node ID 872e9ca29969833bdc11531c8bcb002afe1e5baf # Parent 62d8d545260c88ab92b2b7589d33380d57c766e0 Added fifeagent as component to the Character entity and added a method that attaches the behaviour to the layer diff -r 62d8d545260c -r 872e9ca29969 src/parpg/entities/character.py --- 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)