comparison gamelib/animal.py @ 505:3ed6c011106d

Switch to classmethod decorators.
author Simon Cross <hodgestar@gmail.com>
date Thu, 26 Nov 2009 22:34:58 +0000
parents c1439f6705a2
children d3ceb9e9c48e
comparison
equal deleted inserted replaced
504:393e30ea0165 505:3ed6c011106d
49 self.accoutrements = [] 49 self.accoutrements = []
50 self.abode = None 50 self.abode = None
51 self.facing = 'left' 51 self.facing = 'left'
52 self.gameboard = gameboard 52 self.gameboard = gameboard
53 53
54 @classmethod
54 def make(cls): 55 def make(cls):
55 """Override default Simplifiable object creation.""" 56 """Override default Simplifiable object creation."""
56 return cls((0, 0), None) 57 return cls((0, 0), None)
57 make = classmethod(make) 58
58 59 @classmethod
59 def unsimplify(cls, *args, **kwargs): 60 def unsimplify(cls, *args, **kwargs):
60 """Override default Simplifiable unsimplification.""" 61 """Override default Simplifiable unsimplification."""
61 obj = super(Animal, cls).unsimplify(*args, **kwargs) 62 obj = super(Animal, cls).unsimplify(*args, **kwargs)
62 obj.redraw() 63 obj.redraw()
63 return obj 64 return obj
64 unsimplify = classmethod(unsimplify)
65 65
66 def loop(self, tv, _sprite): 66 def loop(self, tv, _sprite):
67 ppos = tv.tile_to_view(self.pos.to_tile_tuple()) 67 ppos = tv.tile_to_view(self.pos.to_tile_tuple())
68 self.rect.x = ppos[0] 68 self.rect.x = ppos[0]
69 self.rect.y = ppos[1] 69 self.rect.y = ppos[1]