Mercurial > parpg-source
changeset 27:59a4337f328f
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 | da8589a71d94 |
children | bcabbffc88e6 |
files | entities/character.py |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/entities/character.py Sun Sep 04 13:44:10 2011 +0200 +++ b/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)