Mercurial > parpg-core
diff src/parpg/behaviours/base.py @ 73:58661f5b2f6b
Removed layer as attribute of BaseBehaviour and added it as a parameter to the attachToLayer method.
author | KarstenBock@gmx.net |
---|---|
date | Wed, 07 Sep 2011 13:54:02 +0200 |
parents | ad75fa042b99 |
children | c3350fc9cd45 |
line wrap: on
line diff
--- a/src/parpg/behaviours/base.py Wed Sep 07 13:24:02 2011 +0200 +++ b/src/parpg/behaviours/base.py Wed Sep 07 13:54:02 2011 +0200 @@ -19,20 +19,21 @@ class BaseBehaviour (fife.InstanceActionListener): """Fife agent listener""" - def __init__(self, layer=None): + def __init__(self): fife.InstanceActionListener.__init__(self) - self.layer = layer self.agent = None self.state = None self.speed = 0 self.idle_counter = 1 - def attachToLayer(self, agent_ID): + def attachToLayer(self, agent_ID, layer): """Attaches to a certain layer @type agent_ID: String @param agent_ID: ID of the layer to attach to. + @type layer: Fife layer + @param layer: Layer of the agent to attach the behaviour to @return: None""" - self.agent = self.layer.getInstance(agent_ID) + self.agent = layer.getInstance(agent_ID) self.agent.addActionListener(self) self.state = _AGENT_STATE_NONE