Mercurial > rinkhals
diff gamelib/animal.py @ 108:437cbd856a03
Add occupants and abodes. Allowing moving chickens around.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Wed, 02 Sep 2009 18:42:00 +0000 |
parents | d17375586866 |
children | 48019afde338 |
line wrap: on
line diff
--- a/gamelib/animal.py Wed Sep 02 18:26:15 2009 +0000 +++ b/gamelib/animal.py Wed Sep 02 18:42:00 2009 +0000 @@ -20,6 +20,7 @@ self.image_right = image_right self.pos = Position(tile_pos[0], tile_pos[1]) self.equipment = [] + self.abode = None def loop(self, tv, _sprite): ppos = tv.tile_to_view(self.pos.to_tuple()) @@ -31,6 +32,12 @@ # Default is not to move pass + def set_pos(self, tile_pos): + """Move an animal to the given tile_pos.""" + new_pos = Position(*tile_pos) + self._fix_face(new_pos) + self.pos = new_pos + def _fix_face(self, final_pos): """Set the face correctly""" if final_pos.left_of(self.pos):