Mercurial > rinkhals
diff gamelib/animal.py @ 427:e89a1afe4e84
Make Position simplifiable. Override unsimplify for animals to update their image after recreating.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 16:17:48 +0000 |
parents | d34be925b9fc |
children | a356e57529ea |
line wrap: on
line diff
--- a/gamelib/animal.py Sat Nov 21 15:58:54 2009 +0000 +++ b/gamelib/animal.py Sat Nov 21 16:17:48 2009 +0000 @@ -54,6 +54,13 @@ return cls((0, 0)) make = classmethod(make) + def unsimplify(cls, value): + """Override default Simplifiable unsimplification.""" + obj = super(Animal, cls).unsimplify(value) + obj.redraw() + return obj + unsimplify = classmethod(unsimplify) + def loop(self, tv, _sprite): ppos = tv.tile_to_view(self.pos.to_tile_tuple()) self.rect.x = ppos[0]