comparison entities/character.py @ 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 9c7a96c6fe41
children bcabbffc88e6
comparison
equal deleted inserted replaced
26:da8589a71d94 27:59a4337f328f
13 13
14 from parpg.grease import Entity 14 from parpg.grease import Entity
15 15
16 class Character(Entity): 16 class Character(Entity):
17 def __init__(self, world, view_name, real_name, desc, statistics, max_bulk, 17 def __init__(self, world, view_name, real_name, desc, statistics, max_bulk,
18 items=None): 18 identifier, layer=None, behaviour=None, gfx=None, items=None
19 ):
19 self.characterstats.statistics = statistics 20 self.characterstats.statistics = statistics
20 21
21 self.description.view_name = view_name 22 self.description.view_name = view_name
22 self.description.real_name = real_name 23 self.description.real_name = real_name
23 self.description.desc = desc 24 self.description.desc = desc
24 25
25 self.container.children = items or [] 26 self.container.children = items or []
26 self.container.max_bulk = max_bulk 27 self.container.max_bulk = max_bulk
28
29 self.fifeagent.identifier = identifier
30 self.fifeagent.layer = layer
31 self.fifeagent.behaviour = behaviour
32 self.fifeagent.gfx = gfx
33
34 def setup_behaviour(self):
35 """Attach the behaviour to the layer"""
36 if self.fifeagent.behaviour:
37 self.fifeagent.behaviour.attachToLayer(self.fifeagent.identifier)